Skip to content

Instantly share code, notes, and snippets.

@sidharthkuruvila
Created August 22, 2011 07:22
Show Gist options
  • Save sidharthkuruvila/1161848 to your computer and use it in GitHub Desktop.
Save sidharthkuruvila/1161848 to your computer and use it in GitHub Desktop.
Prepend a nullable value to a linked list
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