HashMap<String, String> map = new HashMap<String, String>();
map.add(key, value)
value = map.get()
map.remove(key)
for (String i : map.keySet()) {
System.out.println(i);
}
for (String i : map.values()) {
System.out.println(i);
}
ArrayList<String> listOfKeys = map.keySet().stream().collect(Collectors.toCollection(ArrayList::new));
new ArrayList(map.keySet())
ArrayList<Integer> listOfValues = map.values().stream().collect(Collectors.toCollection(ArrayList::new));
new ArrayList(map.values())
Set<Integer> set = new HashSet<Integer>();
Iterator values = set.iterator();
while (values.hasNext()) {
System.out.println((int) values.next());
}
Integer[] wrapper = new Integer[nums.length];
...
Set<Integer> set = new HashSet<Integer>(Arrays.asList(wrapper));
Arrays.sort(nums);
int[] copiedArray = nums.clone();
Integer[] list = Arrays.stream( data ).boxed().toArray(Integer[]::new);
List<Integer> list = Arrays.stream( data ).boxed().collect(Collectors.toList());
String.valueOf(n)
Integer.toString(i)
char c1 = Character.toLowerCase(c);
Character.isLetterOrDigit(c)
Queue<Integer> queue = new LinkedList<Integer>();
Inserts the specified element into this queue.
queue.add(e)
Retrieves and removes the head of this queue, or returns null if this queue is empty.
queue.poll()
Retrieves and removes the head of this queue.
queue.remove()
Retrieves, but does not remove, the head of this queue, or returns null if this queue is empty.
queue.peek()
Stack<Integer> stack = new Stack<Integer>()
Tests if this stack is empty.
empty()
Looks at the object at the top of this stack without removing it from the stack.
peek()
Removes the object at the top of this stack and returns that object as the value of this function.
pop()
Pushes an item onto the top of this stack.
push(e)
public int Fibonacci(int n) {
int sum = 1;
int before = 1;
int aux = 0;
for (int i = 2; i <= n; i++) {
aux = sum;
sum += before;
before = aux;
}
return sum;
}
public int Fibonacci(int n) {
if (n == 0) {
return 0;
} else if (n < 3) {
return 1;
} else {
return Fibonacci(n-1) + Fibonacci(n-2);
}
}
Random randomGenerator = new Random();
int random = randomGenerator.nextInt(nums.length);
ArrayList<Integer> randomSequence = new ArrayList<Integer>();
Random randomGenerator = new Random();
while (randomSequence.size() < nums.length) {
int random = randomGenerator.nextInt(nums.length);
if (!randomSequence.contains(random)) {
randomSequence.add(random);
}
}
n == 0 ? false : Math.log10(n) / Math.log10(3) % 1 == 0;