Created
December 5, 2013 16:58
-
-
Save olupotd/7809139 to your computer and use it in GitHub Desktop.
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
import java.util.*; | |
public class Listing { | |
LinkedList ll = new LinkedList(); | |
Listing() | |
{ | |
//adding an item to the list | |
l.add(3); | |
l.add(2); | |
//removing an item from the list | |
l.remove(2); | |
//going through the entire list | |
Iterator it = l.iterator(); | |
while(it.hasNext()) | |
{ | |
System.out.println(it.next()); | |
} | |
} | |
pubic static void main(String[] args) | |
{ | |
try{ | |
new Listing(); | |
}catch(Exception except) | |
{ | |
except.printStackTrace(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment