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

info.unterrainer.commons.jreutils.SetIntersection Maven / Gradle / Ivy

There is a newer version: 0.3.15
Show newest version
package info.unterrainer.commons.jreutils;

import java.util.HashSet;
import java.util.Set;

import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.experimental.SuperBuilder;

@Data
@RequiredArgsConstructor
@SuperBuilder()
public class SetIntersection {

	private final Set before;
	private final Set after;

	private final Set create;
	private final Set delete;
	private final Set leave;

	public static  SetIntersection of(final Set before, final Set after) {
		Set create = new HashSet<>(after);
		create.removeAll(before);

		Set delete = new HashSet<>(before);
		delete.removeAll(after);

		Set leave = new HashSet<>(after);
		leave.removeAll(create);

		return new SetIntersection<>(before, after, create, delete, leave);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy