import java.util.HashMap;

public class start {

    public static void main(String args[])  //static method
    {
        String[] data = {"1", "2", "3", "4", "5", "2"};
        transformList(data);
    }

    public static void transformList(String listOfStrings[]) {
        HashMap<String, Integer> maps = new HashMap<>();
        for (int x = 0; x < listOfStrings.length; x++) {
            if (!maps.containsKey(listOfStrings[x])) {
                maps.put(listOfStrings[x], x);
                return;
            }
            System.out.println("We have the key hence there is a loop");
        }
    }
}