View on GitHub

CC

CC practice and cheat sheets

Set, HashSet and TreeSet

Find Maximum in a set
Set<Integer> s = new HasHSet<>();
.
.
int maximum = Collections.max(s);
Remove Element from Set
Set<Integer> s = new HashSet<>();
int maximum = Collections.max(s);
s.remove(maximum);
Other functions
Set<Integer> s = new HashSet<>();
int size = s.size();
boolean b = s.contains(50);