Skip to content

Instantly share code, notes, and snippets.

@abbath0767
Created March 6, 2019 12:10
Show Gist options
  • Save abbath0767/7c9a2b3ff15eacfd5bc28b28a957cf28 to your computer and use it in GitHub Desktop.
Save abbath0767/7c9a2b3ff15eacfd5bc28b28a957cf28 to your computer and use it in GitHub Desktop.
Reversed SingleLinkedList
public class Main {
public static void main(String[] args) {
SingleLinkList<Integer> list = new SingleLinkList<>();
Random rand = new Random();
for (int i = 0; i < 10; i++) {
list.add(rand.nextInt(100));
}
System.out.println("List data: " + list.toString() + " with size: " + list.size());
list.reverse();
System.out.println("Reversed list: " + list.toString() + " with size: " + list.size());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment