java.lang.Integer

Coderanch | Rob Spoor | 8 years ago
  1. 0

    How to over ride the List.contains() method.

    Coderanch | 8 years ago | Rob Spoor
    java.lang.Integer
  2. 0

    HashMap get/put

    Google Groups | 7 years ago | Wojtek
    java.lang.Integer
  3. 0

    Variable arguments will be converted to WrappedArray implicitly with proper component type, but under below case, for ArrayWrapper.updateOne method, the argument will be converted to WrappedArray$ofRef (should be WrappedArray$ofDouble) discarding the declared type parameter [T] (Double here, for example). The code below is similar to Scala's collections library code, and works under Scala 2.9.x. {code} import scala.collection.mutable.WrappedArray import scala.reflect.ClassTag object Main { def main(args: Array[String]) { val test = new ArrayWrapper[Double] test.update(1.0) // ok test.updateOne(1.0) // failure with ArrayStoreExcpetion } } class ArrayWrapper[T: ClassTag] { val array = new Array[T](2) // elem will be boxed to java.lang.Object (java.lang.Double), then wrapped as // Array[Object] and passed to scala.LowPriorityImplicits.genericWrapArray[T](xs: Array[T]) // becaues of update(elems: T*), and causes ArrayStoreException. def updateOne(elem: T) { update(elem) } // ok when called outside directly def update(elems: T*) { updateAll(elems) } def updateAll(elems: scala.collection.Traversable[T]) { println(elems.getClass) // class scala.collection.mutable.WrappedArray$ofDouble -- when via update // class scala.collection.mutable.WrappedArray$ofRef -- when via updateOne elems match { case xs: WrappedArray[T] => println(xs.array) // [D@504ad009 --- when via update // [Ljava.lang.Object;@3b87bd31 --- when via updateOne array(0) = xs.array(0) // ok System.arraycopy(xs.array, 0, array, 0, xs.length) // ok --- when via update // failure with java.lang.ArrayStoreException --- when via updateOne println("== ok ==") case _ => } } } {code}

    Scala JIRA | 4 years ago | Caoyuan Deng
    java.lang.Integer
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    better error messages > smaller stack traces

    Google Groups | 6 years ago | stuart....@gmail.com
    java.lang.Integer

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.Integer

      No message provided

      at java.lang.Integer.compareTo()
    2. Java RT
      TreeMap.get
      1. java.lang.Integer.compareTo(Unknown Source)
      2. java.util.TreeMap.getEntry(Unknown Source)
      3. java.util.TreeMap.get(Unknown Source)
      3 frames
    3. Unknown
      Test.main
      1. Test.main(Test.java:13)
      1 frame