All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.javers.common.collections.Collections Maven / Gradle / Ivy

There is a newer version: 7.6.1
Show newest version
package org.javers.common.collections;

import java.util.Collection;
import java.util.List;
import java.util.Set;

/**
 * @author pawel szymczyk
 */
public class Collections {
    public static  Collection difference(Collection first, Collection second) {
        if (first instanceof List) {
            return Lists.difference((List) first,(List) second);
        } else if (first instanceof Set) {
            return Sets.difference((Set) first,(Set) second);
        } else {
            throw new IllegalArgumentException("At this moment Javers don't support "  + first.getClass().getSimpleName());
        }
    }

    public static Collection wrapNull(Object sourceCollection) {
        if (sourceCollection == null) {
            return java.util.Collections.emptySet();
        }
        else{
            return (Collection)sourceCollection;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy