How do I remove repeated elements from ArrayList?

后端 未结 30 1608
难免孤独
难免孤独 2020-11-21 06:24

I have an ArrayList, and I want to remove repeated strings from it. How can I do this?

30条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-21 06:44

    If you want to remove duplicates from ArrayList means find the below logic,

    public static Object[] removeDuplicate(Object[] inputArray)
    {
        long startTime = System.nanoTime();
        int totalSize = inputArray.length;
        Object[] resultArray = new Object[totalSize];
        int newSize = 0;
        for(int i=0; i

提交回复
热议问题