You are on page 1of 2

// import java.util.

Scanner;
// import java.util.function.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Vector;
import java.util.Deque;
import java.util.Queue;
import java.util.PriorityQueue;
import java.util.Stack;
import java.util.Set;
import java.util.HashSet;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.Map;
import java.util.HashMap;
import java.util.TreeMap;

public class Main {

public static void main(String args[]) {


// List<String> arrList = new ArrayList<String>();

// List<String> vecList = new Vector<String>();


// // List<String> stackList = new Stack<String>();
// if (arrList.isEmpty()) {
// System.out.println("Collection is empty");
// }
// // arrList1.add("John");
// if (arrList.add("Bryan")) {
// System.out.println("Sucessfully add element on Collection");
// }
// arrList.add("Vern");
// arrList.add("Micah");
// arrList.add("Joyce");
// arrList.add("Keith");

// arrList.remove(1);
// // arrList.addAll(arrList1);
// // arrList.lastIndexOf(arrList);
// System.out.println(arrList.indexOf("Micah") + " index of Micah");
// System.out.println(arrList.size() + " size of List");
// arrList.forEach(n -> System.out.println(n));

// Iterator it = arrList.iterator();
// while (it.hasNext()) {
// if (arrList.contains("Bryan"))
// System.out.println(it.next());
// }
// Stack<String> stackList = new Stack<String>();
// stackList.add("Jack");
// stackList.add(1, "Jack");
// stackList.push("Queen");
// stackList.push("King");
// stackList.push("Ace");
// stackList.pop();
// System.out.println(stackList.peek());
// stackList.forEach(n -> System.out.println(n));

// Queue<String> queue = new PriorityQueue<String>();


// queue.add("John");
// queue.offer("Jack");
// queue.offer("Abigail");
// queue.poll();

// queue.forEach(n -> System.out.println(n));

// Deque<String> linkList = new LinkedList<String>();


// linkList.add("Zero");
// linkList.add("One");
// linkList.add("Two");
// linkList.add("Three");
// linkList.add("Four");
// linkList.push("Five");
// linkList.push("Six");
// linkList.push("Seven");
// linkList.pop();
// linkList.offerFirst("negative one");
// linkList.offer("negative two");
// linkList.offer("negative three");
// linkList.pollFirst();

Set<String> set = new HashSet<String>();


set.add("Vern");
set.add("Vern");
set.add("Bryan");
set.add("Bryan");

System.out.println(set.size());
set.forEach(n -> System.out.println(n));
System.out.println("");
SortedSet<String> treeset = new TreeSet<String>();
treeset.add("Vern");
treeset.add("vern");
treeset.add("Bryan");
treeset.add("bryan");

treeset.forEach(n -> System.out.println(n));

Map<String, Integer> map = new TreeMap<String, Integer>();


map.put("Vern", 1);
map.put("Vern", 1);
map.put("Vern", 1);
map.put("Vern", 1);
// map.remove("Vern");
map.forEach( ( m, n) -> System.out.println("Key :" + m +
" " + "Value :" + n));
// String arrList1[] = { "Vern", null, "Micah", "Joyce", "Keith" };
// arrList1[5] = "Montorio";
}
}

You might also like