Part of the Alchemy Collection,
Alchemy Collections contains Algorithms and Operations you would intuitively
expect to perform on a java Collection
.
Because odds are, if you want to do it, someone else does too,
To use, simply add the following maven dependency.
<dependency>
<groupId>tech.sirwellington.alchemy</groupId>
<artifactId>alchemy-collections</artifactId>
<version>2.0</version>
</dependency>
First add the Snapshot Repository
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
<dependency>
<groupId>tech.sirwellington.alchemy</groupId>
<artifactId>alchemy-collections</artifactId>
<version>2.1-SNAPSHOT</version>
</dependency>
sir.wellington.alchemy.collections.lists.Lists
List<User> users = Lists.create();
List<User> defensiveCopy = Lists.immutableCopyOf(users);
List<People> clique = Lists.combine(family, coworkers, enemies, neighbors);
List<String> strings = ...;
String anyString = Lists.oneOf(strings);
sir.wellington.alchemy.collections.maps.Maps
Map<Integer, String> map = Maps.create();
Map<Integer, String> defensiveCopy = Maps.immutableCopyOf(map);
Map<String, Object> first = ...;
Map<String, Object> second = ...;
Map<String, Object> merged = Maps.merge(first, second);
sir.wellington.alchemy.collections.sets.Sets
A Union combines two or more sets into one.
Set<String> first = Sets.createFrom("one", "two", "three");
Set<String> second = Sets.createFrom("four", "crab");
Set<String> union = Sets.unionOf(first, second);
// {"one", "two", "three", "four", crab"}
An Intersection finds the elements in common between two or more sets.
Set<String> first = Sets.createFrom("You", "Are", "What", "You", "Create");
Set<String> second = Sets.createFrom("What", "You", "Create", "Creates" "You");
Set<String> intersection = Sets.intersectionOf(first, second);
//{ "You", "Create"}
- Java 8
- Maven
This project builds with maven. Just run a mvn clean install
to compile and install to your local maven repository
Initial Public Release.
This Software is licensed under the Apache 2.0 License