java - How to give a default value to a List in Scala? -


i have following part of code gives me java.lang.nullpointerexception, found source , know declared variable set null , later in program initialized don't know how give default value without getting error! list accepts 2 different types, float , rdd. here part of code has problem in it:

case class rpn (sc:sparkcontext, vp: volumeproperty, var stack:list[either[rdd[(int, array[float])],float]]) {  def this(s:sparkcontext,v:volumeproperty) = this(s,v,null); //think here problem  def operand(x: either[rdd[(int, array[float])],float]) = new rpn(sc,vp,stack = x :: stack) //gives error on line 

and getting following error:

exception in thread "main" java.lang.nullpointerexception 

how can solve it!

use nil instead of null. nil empty list.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -