public static List<StoreResource> dedupeListing( final List<StoreResource> listing )
    {
        final List<StoreResource> result = new ArrayList<StoreResource>();
        final Map<String, StoreResource> mapping = new LinkedHashMap<String, StoreResource>();
        for ( final StoreResource res : listing )
        {
            final String path = res.getPath();
            if ( mapping.containsKey( path ) )
            {
                continue;
            }

            if ( mapping.containsKey( path + "/" ) )
            {
                continue;
            }

            mapping.put( path, res );
            result.add( res );
        }

        return result;
    }
public static List<StoreResource> dedupeListing( final List<StoreResource> listing )
    {
        final List<StoreResource> result = new ArrayList<StoreResource>();
        final Map<String, StoreResource> mapping = new LinkedHashMap<String, StoreResource>();
        for ( final StoreResource res : listing )
        {
            final String path = res.getPath();
            if ( mapping.containsKey( path ) )
            {
                continue;
            }

            if ( mapping.containsKey( path + "/" ) )
            {
                continue;
            }

            mapping.put( path, res );
            result.add( res );
        }

        return result;
    }
public static List < StoreResource > dedupeListing ( final List < StoreResource > listing ) { final List < StoreResource > result = new ArrayList < StoreResource > ( ) ; final Map < String , StoreResource > mapping = new LinkedHashMap < String , StoreResource > ( ) ; for ( final StoreResource res : listing ) { final String path = res . getPath ( ) ; if ( mapping . containsKey ( path ) ) { continue ; } if ( mapping . containsKey ( path + "/" ) ) { continue ; } mapping . put ( path , res ) ; result . add ( res ) ; } return result ; }
Attempt to remove duplicates, even "fuzzy" ones where a directory is
listed with trailing '/' in some cases but not others.
Attempt to remove duplicates even fuzzy ones where a directory is listed with trailing / in some cases but not others .