java arraylist : same values to a new arraylist

Posted by j0hns3n on Stack Overflow See other posts from Stack Overflow or by j0hns3n
Published on 2012-11-15T10:42:33Z Indexed on 2012/11/15 11:01 UTC
Read the original article Hit count: 681

Filed under:
|
public static void rechnung(List<String> array) {
    for (int i = 0; i < array.size(); i++) {
        for (int j = 0; j < array.size(); j++) {
            if (i != j) {
                System.out.println(array.get(i)
                        + " gleich "
                        + array.get(j)
                        + " "
                        + (array.get(i).substring(0, 9).equals(array.get(j)
                                .substring(0, 9))));
            }
        }
    }
}

My Intension is to put the same values with the same date from a List in a new List. At the end I've for example three new Lists.

List content:

03.07.2007 00001.tif
03.07.2007 00002.tif
18.02.2008 00003.tif
18.02.2008 00004.tif
18.02.2008 00005.tif
11.03.2009 00004.tif
11.03.2009 00005.tif

© Stack Overflow or respective owner

Related posts about java

Related posts about arraylist