OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 156 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 156 Rev 182
Line 1... Line 1...
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
3
 * 
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
4
 * Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
5
 * 
5
 * 
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
9
 * language governing permissions and limitations under the License.
Line 280... Line 280...
280
        public boolean equals(Object o1, Object o2) {
280
        public boolean equals(Object o1, Object o2) {
281
            return CompareUtils.equals(o1, o2);
281
            return CompareUtils.equals(o1, o2);
282
        }
282
        }
283
    };
283
    };
284
 
284
 
285
    static public final <T> boolean equals(List<T> l1, List<T> l2, Equalizer<? super T> comp) {
285
    static public final <T> boolean equals(List<? extends T> l1, List<? extends T> l2, Equalizer<? super T> comp) {
286
        return compare(l1, l2, comp, null) == null;
286
        return compare(l1, l2, comp, null) == null;
287
    }
287
    }
288
 
288
 
289
    /**
289
    /**
290
     * Compare two lists using the provided comparator.
290
     * Compare two lists using the provided comparator.
Line 295... Line 295...
295
     * @param comp how to compare each item.
295
     * @param comp how to compare each item.
296
     * @param toString how to dispay items, can be <code>null</code>.
296
     * @param toString how to dispay items, can be <code>null</code>.
297
     * @return <code>null</code> if the two lists are equal, otherwise a String explaining the
297
     * @return <code>null</code> if the two lists are equal, otherwise a String explaining the
298
     *         difference.
298
     *         difference.
299
     */
299
     */
300
    static public final <T> String compare(List<T> l1, List<T> l2, Equalizer<? super T> comp, final ITransformer<? super T, String> toString) {
300
    static public final <T> String compare(List<? extends T> l1, List<? extends T> l2, Equalizer<? super T> comp, final ITransformer<? super T, String> toString) {
301
        final int size = l1.size();
301
        final int size = l1.size();
302
        if (size != l2.size())
302
        if (size != l2.size())
303
            return "unequal size";
303
            return "unequal size";
304
        for (int i = 0; i < size; i++) {
304
        for (int i = 0; i < size; i++) {
305
            final T o1 = l1.get(i);
305
            final T o1 = l1.get(i);