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

//create class
class enemies {
   int marks;
}
//create object array
enemies[] enemiesArray = new enemies[7];
//assign value to object
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)

// Example with predicate
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

// Using hashtable.keySet()

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>();
        //add key-value pair to Hashtable
        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);
        }
    }
}