can there be two items in one item of arraylist in java code example
Example 1: how to make array of objects in java and use it
class enemies {
int marks;
}
enemies[] enemiesArray = new enemies[7];
enemiesArray[5] = new enemies(95);
Example 2: java find if element of list in present in another list
list1.stream()
.map(Object1::getProperty)
.anyMatch(
list2.stream()
.map(Object2::getProperty)
.collect(toSet())
::contains)
Predicate<Object> notInList1 = object -> list1.stream().noneMatch(object::equals);
List<Object> missingInList1 = list2.stream().filter(notInList1).collect(Collectors.toList());
Example 3: how to get all the elements in Hashtable java
package com.java2novice.hashtable;
import java.util.Hashtable;
import java.util.Set;
public class MyHashtableKeys {
public static void main(String a[]){
Hashtable<String, String> hm = new Hashtable<String, String>();
hm.put("first", "FIRST INSERTED");
hm.put("second", "SECOND INSERTED");
hm.put("third","THIRD INSERTED");
System.out.println(hm);
Set<String> keys = hm.keySet();
for(String key: keys){
System.out.println(key);
}
}
}