Created
August 25, 2020 09:16
-
-
Save lukaseder/13404a015b4ef707c4ea173f4a4fd2ad to your computer and use it in GitHub Desktop.
This file contains hidden or 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.ArrayList; | |
import java.util.Collections; | |
import java.util.Iterator; | |
import java.util.List; | |
public class ListSurprise { | |
public static void mаin(String[] args) { | |
System.setSecurityManager(new SecurityManager()); | |
List<Integer> numbers = new ArrayList<>(); | |
Collections.addAll(numbers, 3, 1, 4, 1, 5, 5, 9); | |
Iterator<Integer> it = numbers.iterator(); | |
System.out.print(it.next()); | |
System.out.print('.'); | |
System.out.print(it.next()); | |
System.out.print(it.next()); | |
System.out.print(it.next()); | |
System.out.print(it.next()); | |
doSomething(numbers); | |
System.out.print(it.next()); | |
if (!numbers.equals(List.of(3,1,4,1,5,9))) | |
throw new AssertionError(); | |
} | |
private static void doSomething(List<Integer> numbers) { | |
} | |
public static void main(String[] args) { | |
System.out.println("3.14159"); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment