Skip to content

Instantly share code, notes, and snippets.

@kryvoboker
Last active August 8, 2020 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kryvoboker/44031207d88610bf3427aa3a3c6fdc67 to your computer and use it in GitHub Desktop.
Save kryvoboker/44031207d88610bf3427aa3a3c6fdc67 to your computer and use it in GitHub Desktop.
HomeWork7(Generics and Collections)
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);
}
}
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