This week's book giveaway is in the Python forum.
We're giving away four copies of Python Continuous Integration and Delivery and have Moritz Lenz on-line!
See this thread for details.
Win a copy of Python Continuous Integration and Delivery this week in the Python forum!

Colin Wang

Greenhorn
+ Follow
since Nov 24, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Colin Wang

Saibabaa Pragada wrote:Hi, this is from Exam Lab. I read that static variables do not participate in Serialization. But, here it participates in Serialization..Why ??


"Primitives as well as non-transient, non-static referenced objects are encoded into the stream. " from wikipedia

Henry Wong wrote:Java doubles follow the IEEE specification. The IEEE specification for floating point defines special values for Infinity, Negative infinity, Negative zero, and NaN (not a number). These are actually defined numbers, along with operations that generate them.

Java integers follow the twos complement format. There are no special definitions for any of the above values. In this case, there is no representation of a NaN for an integer.

Henry


Java follow the IEEE specification on double/float, but no specification on int.

Tianrong Dai wrote:What's the difference between servlet and jsp, who can tell me in simple words?


JSP will be translated into servlet.
8 years ago
Perfect comments.
Thank you.

Jesper de Jong wrote:There are some important things to note with the solutions given above:

Garrett's solution, with Arrays.asList() is efficient because it doesn't need to copy the content of the array. This method returns a List that is a "view" onto the array - a wrapper that makes the array look like a list. When you change an element in the list, the element in the original array is also changed. Note that the list is fixed size - if you try to add elements to the list, you'll get an exception.

Ernest's solution: new ArrayList(Arrays.asList(myArray)); copies the content of the array to a new ArrayList. The copy is ofcourse independent of the array, and you can add, remove etc. elements as you like.

Janarthan's solution, with Collections.addAll(myList, myStringArray); is essentially the same as Ernest's solution.

If you only need read access to the array as if it is a List and you don't want to add or remove elements from the list, then use Garrett's solution. Otherwise use Ernest's or Janarthan's solution.

8 years ago