Last active
August 8, 2020 20:11
-
-
Save kryvoboker/44031207d88610bf3427aa3a3c6fdc67 to your computer and use it in GitHub Desktop.
HomeWork7(Generics and Collections)
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.ArrayList; | |
import java.util.NavigableSet; | |
/** | |
* | |
* @author kamaz | |
*/ | |
public class List { | |
private ArrayList<Integer> list = new ArrayList<>(); | |
public List() { | |
super(); | |
} | |
public void setList() throws InterruptedException { | |
list.add((int) (Math.random() * 100)); | |
list.add((int) (Math.random() * 100)); | |
list.add((int) (Math.random() * 100)); | |
list.add((int) (Math.random() * 100)); | |
list.add((int) (Math.random() * 100)); | |
list.add((int) (Math.random() * 100)); | |
list.add((int) (Math.random() * 100)); | |
list.add((int) (Math.random() * 100)); | |
list.add((int) (Math.random() * 100)); | |
list.add((int) (Math.random() * 100)); | |
System.out.println(list); | |
Thread.sleep(1000); | |
list.remove(0); | |
list.remove(0); | |
list.remove(list.size() - 1); | |
System.out.println(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
public class Main { | |
public static void main(String[] args) throws InterruptedException { | |
List list = new List(); | |
list.setList(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment