Created
August 22, 2011 07:22
-
-
Save sidharthkuruvila/1161848 to your computer and use it in GitHub Desktop.
Prepend a nullable value to a linked list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Integer i = canReturnNull(); | |
LinkedList<Integer> l = new LinkedList<Integer>(Arrays.asList(2,3,4)); | |
if(i != null){ | |
l.addFirst(i); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment