From 0064093dbf6ef62fff958ff9eca8adf9ffcd8184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Sun, 27 Sep 2020 16:18:37 +0200 Subject: [PATCH] :sparkles: Add generic product types --- .../commands/types/tuples/Pair.java | 107 ++++++++++ .../commands/types/tuples/Quartet.java | 145 ++++++++++++++ .../commands/types/tuples/Quintet.java | 164 ++++++++++++++++ .../commands/types/tuples/Sextet.java | 184 ++++++++++++++++++ .../commands/types/tuples/Triplet.java | 126 ++++++++++++ .../commands/types/tuples/Tuples.java | 141 ++++++++++++++ .../commands/types/tuples/package-info.java | 29 +++ 7 files changed, 896 insertions(+) create mode 100644 cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Pair.java create mode 100644 cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Quartet.java create mode 100644 cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Quintet.java create mode 100644 cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Sextet.java create mode 100644 cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Triplet.java create mode 100644 cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Tuples.java create mode 100644 cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/package-info.java diff --git a/cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Pair.java b/cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Pair.java new file mode 100644 index 00000000..963d4831 --- /dev/null +++ b/cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Pair.java @@ -0,0 +1,107 @@ +// +// MIT License +// +// Copyright (c) 2020 Alexander Söderberg +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// +package com.intellectualsites.commands.types.tuples; + +import com.google.common.base.Objects; + +import javax.annotation.Nonnull; + +/** + * Immutable generic 2-tuple + * + * @param First type + * @param Second type + */ +public class Pair { + + @Nonnull + private final U first; + @Nonnull + private final V second; + + protected Pair(@Nonnull final U first, + @Nonnull final V second) { + this.first = first; + this.second = second; + } + + /** + * Create a new 2-tuple + * + * @param first First value + * @param second Second value + * @param First type + * @param Second type + * @return Created pair + */ + @Nonnull + public static Pair of(@Nonnull final U first, + @Nonnull final V second) { + return new Pair<>(first, second); + } + + /** + * Get the first value + * + * @return First value + */ + @Nonnull + public final U getFirst() { + return this.first; + } + + /** + * Get the second value + * + * @return Second value + */ + @Nonnull + public final V getSecond() { + return this.second; + } + + @Override + public final boolean equals(final Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final Pair pair = (Pair) o; + return Objects.equal(getFirst(), pair.getFirst()) + && Objects.equal(getSecond(), pair.getSecond()); + } + + @Override + public final int hashCode() { + return Objects.hashCode(getFirst(), getSecond()); + } + + @Override + public final String toString() { + return String.format("(%s, %s)", this.first, this.second); + } + +} diff --git a/cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Quartet.java b/cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Quartet.java new file mode 100644 index 00000000..134df02b --- /dev/null +++ b/cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Quartet.java @@ -0,0 +1,145 @@ +// +// MIT License +// +// Copyright (c) 2020 Alexander Söderberg +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// +package com.intellectualsites.commands.types.tuples; + +import com.google.common.base.Objects; + +import javax.annotation.Nonnull; + +/** + * Immutable generic 5-tuple + * + * @param First type + * @param Second type + * @param Third type + * @param Fourth type + */ +public class Quartet { + + @Nonnull + private final U first; + @Nonnull + private final V second; + @Nonnull + private final W third; + @Nonnull + private final X fourth; + + protected Quartet(@Nonnull final U first, + @Nonnull final V second, + @Nonnull final W third, + @Nonnull final X fourth) { + this.first = first; + this.second = second; + this.third = third; + this.fourth = fourth; + } + + /** + * Create a new 4-tuple + * + * @param first First value + * @param second Second value + * @param third Third value + * @param fourth Fourth value + * @param First type + * @param Second type + * @param Third type + * @param Fourth type + * @return Created quartet + */ + @Nonnull + public static Quartet of(@Nonnull final U first, + @Nonnull final V second, + @Nonnull final W third, + @Nonnull final X fourth) { + return new Quartet<>(first, second, third, fourth); + } + + /** + * Get the first value + * + * @return First value + */ + @Nonnull + public final U getFirst() { + return this.first; + } + + /** + * Get the second value + * + * @return Second value + */ + @Nonnull + public final V getSecond() { + return this.second; + } + + /** + * Get the third value + * + * @return Third value + */ + @Nonnull + public final W getThird() { + return this.third; + } + + /** + * Get the fourth value + * + * @return Fourth value + */ + @Nonnull + public final X getFourth() { + return this.fourth; + } + + @Override + public final boolean equals(final Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final Quartet quartet = (Quartet) o; + return Objects.equal(getFirst(), quartet.getFirst()) + && Objects.equal(getSecond(), quartet.getSecond()) + && Objects.equal(getThird(), quartet.getThird()) + && Objects.equal(getFourth(), quartet.getFourth()); + } + + @Override + public final int hashCode() { + return Objects.hashCode(getFirst(), getSecond(), getThird(), getFourth()); + } + + @Override + public final String toString() { + return String.format("(%s, %s, %s, %s)", this.first, this.second, this.third, this.fourth); + } + +} diff --git a/cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Quintet.java b/cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Quintet.java new file mode 100644 index 00000000..55997cc8 --- /dev/null +++ b/cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Quintet.java @@ -0,0 +1,164 @@ +// +// MIT License +// +// Copyright (c) 2020 Alexander Söderberg +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// +package com.intellectualsites.commands.types.tuples; + +import com.google.common.base.Objects; + +import javax.annotation.Nonnull; + +/** + * Immutable generic 5-tuple + * + * @param First type + * @param Second type + * @param Third type + * @param Fourth type + * @param Fifth type + */ +public class Quintet { + + @Nonnull + private final U first; + @Nonnull + private final V second; + @Nonnull + private final W third; + @Nonnull + private final X fourth; + @Nonnull + private final Y fifth; + + protected Quintet(@Nonnull final U first, + @Nonnull final V second, + @Nonnull final W third, + @Nonnull final X fourth, + @Nonnull final Y fifth) { + this.first = first; + this.second = second; + this.third = third; + this.fourth = fourth; + this.fifth = fifth; + } + + /** + * Create a new 5-tuple + * + * @param first First value + * @param second Second value + * @param third Third value + * @param fourth Fourth value + * @param fifth fifth value + * @param First type + * @param Second type + * @param Third type + * @param Fourth type + * @param Fifth type + * @return Created quintet + */ + @Nonnull + public static Quintet of(@Nonnull final U first, + @Nonnull final V second, + @Nonnull final W third, + @Nonnull final X fourth, + @Nonnull final Y fifth) { + return new Quintet<>(first, second, third, fourth, fifth); + } + + /** + * Get the first value + * + * @return First value + */ + @Nonnull + public final U getFirst() { + return this.first; + } + + /** + * Get the second value + * + * @return Second value + */ + @Nonnull + public final V getSecond() { + return this.second; + } + + /** + * Get the third value + * + * @return Third value + */ + @Nonnull + public final W getThird() { + return this.third; + } + + /** + * Get the fourth value + * + * @return Fourth value + */ + @Nonnull + public final X getFourth() { + return this.fourth; + } + + /** + * Get the fifth value + * + * @return Fifth value + */ + @Nonnull + public final Y getFifth() { + return this.fifth; + } + + @Override + public final boolean equals(final Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final Quintet quintet = (Quintet) o; + return Objects.equal(getFirst(), quintet.getFirst()) + && Objects.equal(getSecond(), quintet.getSecond()) + && Objects.equal(getThird(), quintet.getThird()) + && Objects.equal(getFourth(), quintet.getFourth()) + && Objects.equal(getFifth(), quintet.getFifth()); + } + + @Override + public final int hashCode() { + return Objects.hashCode(getFirst(), getSecond(), getThird(), getFourth(), getFifth()); + } + + @Override + public final String toString() { + return String.format("(%s, %s, %s, %s, %s)", this.first, this.second, this.third, this.fourth, this.fifth); + } + +} diff --git a/cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Sextet.java b/cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Sextet.java new file mode 100644 index 00000000..4832a8b7 --- /dev/null +++ b/cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Sextet.java @@ -0,0 +1,184 @@ +// +// MIT License +// +// Copyright (c) 2020 Alexander Söderberg +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// +package com.intellectualsites.commands.types.tuples; + +import com.google.common.base.Objects; + +import javax.annotation.Nonnull; + +/** + * Immutable generic 6-tuple + * + * @param First type + * @param Second type + * @param Third type + * @param Fourth type + * @param Fifth type + * @param Sixth type + */ +public class Sextet { + + @Nonnull + private final U first; + @Nonnull + private final V second; + @Nonnull + private final W third; + @Nonnull + private final X fourth; + @Nonnull + private final Y fifth; + @Nonnull + private final Z sixth; + + protected Sextet(@Nonnull final U first, + @Nonnull final V second, + @Nonnull final W third, + @Nonnull final X fourth, + @Nonnull final Y fifth, + @Nonnull final Z sixth) { + this.first = first; + this.second = second; + this.third = third; + this.fourth = fourth; + this.fifth = fifth; + this.sixth = sixth; + } + + /** + * Create a new 6-tuple + * + * @param first First value + * @param second Second value + * @param third Third value + * @param fourth Fourth value + * @param fifth fifth value + * @param sixth Sixth value + * @param First type + * @param Second type + * @param Third type + * @param Fourth type + * @param Fifth type + * @param Sixth type + * @return Created sextet + */ + @Nonnull + public static Sextet of(@Nonnull final U first, + @Nonnull final V second, + @Nonnull final W third, + @Nonnull final X fourth, + @Nonnull final Y fifth, + @Nonnull final Z sixth) { + return new Sextet<>(first, second, third, fourth, fifth, sixth); + } + + /** + * Get the first value + * + * @return First value + */ + @Nonnull + public final U getFirst() { + return this.first; + } + + /** + * Get the second value + * + * @return Second value + */ + @Nonnull + public final V getSecond() { + return this.second; + } + + /** + * Get the third value + * + * @return Third value + */ + @Nonnull + public final W getThird() { + return this.third; + } + + /** + * Get the fourth value + * + * @return Fourth value + */ + @Nonnull + public final X getFourth() { + return this.fourth; + } + + /** + * Get the fifth value + * + * @return Fifth value + */ + @Nonnull + public final Y getFifth() { + return this.fifth; + } + + /** + * Get the sixth value + * + * @return Sixth value + */ + @Nonnull + public final Z getSixth() { + return this.sixth; + } + + @Override + public final boolean equals(final Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final Sextet sextet = (Sextet) o; + return Objects.equal(getFirst(), sextet.getFirst()) + && Objects.equal(getSecond(), sextet.getSecond()) + && Objects.equal(getThird(), sextet.getThird()) + && Objects.equal(getFourth(), sextet.getFourth()) + && Objects.equal(getFifth(), sextet.getFifth()) + && Objects.equal(getSixth(), sextet.getSixth()); + } + + @Override + public final int hashCode() { + return Objects.hashCode(getFirst(), getSecond(), getThird(), getFourth(), getFifth(), getSixth()); + } + + @Override + public final String toString() { + return String.format("(%s, %s, %s, %s, %s, %s)", this.first, this.second, this.third, + this.fourth, this.fifth, this.sixth); + } + +} diff --git a/cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Triplet.java b/cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Triplet.java new file mode 100644 index 00000000..0c0f89b9 --- /dev/null +++ b/cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Triplet.java @@ -0,0 +1,126 @@ +// +// MIT License +// +// Copyright (c) 2020 Alexander Söderberg +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// +package com.intellectualsites.commands.types.tuples; + +import com.google.common.base.Objects; + +import javax.annotation.Nonnull; + +/** + * Immutable generic 3-tuple + * + * @param First type + * @param Second type + * @param Third type + */ +public class Triplet { + + @Nonnull + private final U first; + @Nonnull + private final V second; + @Nonnull + private final W third; + + protected Triplet(@Nonnull final U first, + @Nonnull final V second, + @Nonnull final W third) { + this.first = first; + this.second = second; + this.third = third; + } + + /** + * Create a new 3-tuple + * + * @param first First value + * @param second Second value + * @param third Third value + * @param First type + * @param Second type + * @param Third type + * @return Created triplet + */ + @Nonnull + public static Triplet of(@Nonnull final U first, + @Nonnull final V second, + @Nonnull final W third) { + return new Triplet<>(first, second, third); + } + + /** + * Get the first value + * + * @return First value + */ + @Nonnull + public final U getFirst() { + return this.first; + } + + /** + * Get the second value + * + * @return Second value + */ + @Nonnull + public final V getSecond() { + return this.second; + } + + /** + * Get the third value + * + * @return Third value + */ + @Nonnull + public final W getThird() { + return this.third; + } + + @Override + public final boolean equals(final Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final Triplet triplet = (Triplet) o; + return Objects.equal(getFirst(), triplet.getFirst()) + && Objects.equal(getSecond(), triplet.getSecond()) + && Objects.equal(getThird(), triplet.getThird()); + } + + @Override + public final int hashCode() { + return Objects.hashCode(getFirst(), getSecond(), getThird()); + } + + @Override + public final String toString() { + return String.format("(%s, %s, %s)", this.first, this.second, this.third); + } + +} diff --git a/cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Tuples.java b/cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Tuples.java new file mode 100644 index 00000000..47eb1481 --- /dev/null +++ b/cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/Tuples.java @@ -0,0 +1,141 @@ +// +// MIT License +// +// Copyright (c) 2020 Alexander Söderberg +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// +package com.intellectualsites.commands.types.tuples; + +import javax.annotation.Nonnull; + +/** + * Utility class for dealing with tuples + */ +public final class Tuples { + + private Tuples() { + } + + /** + * Create a new pair + * + * @param first First value + * @param second Second value + * @param First type + * @param Second type + * @return Created pair + */ + @Nonnull + public static Pair of(@Nonnull final U first, + @Nonnull final V second) { + return Pair.of(first, second); + } + + /** + * Create a new triplet + * + * @param first First value + * @param second Second value + * @param third Third value + * @param First type + * @param Second type + * @param Third type + * @return Created triplet + */ + @Nonnull + public static Triplet of(@Nonnull final U first, + @Nonnull final V second, + @Nonnull final W third) { + return Triplet.of(first, second, third); + } + + /** + * Create a new quartet + * + * @param first First value + * @param second Second value + * @param third Third value + * @param fourth Fourth value + * @param First type + * @param Second type + * @param Third type + * @param Fourth type + * @return Created quartet + */ + @Nonnull + public static Quartet of(@Nonnull final U first, + @Nonnull final V second, + @Nonnull final W third, + @Nonnull final X fourth) { + return Quartet.of(first, second, third, fourth); + } + + /** + * Create a new quintet + * + * @param first First value + * @param second Second value + * @param third Third value + * @param fourth Fourth value + * @param fifth Fifth value + * @param First type + * @param Second type + * @param Third type + * @param Fourth type + * @param Fifth type + * @return Created quintet + */ + @Nonnull + public static Quintet of(@Nonnull final U first, + @Nonnull final V second, + @Nonnull final W third, + @Nonnull final X fourth, + @Nonnull final Y fifth) { + return Quintet.of(first, second, third, fourth, fifth); + } + + /** + * Create a new sextet + * + * @param first First value + * @param second Second value + * @param third Third value + * @param fourth Fourth value + * @param fifth Fifth value + * @param sixth Sixth value + * @param First type + * @param Second type + * @param Third type + * @param Fourth type + * @param Fifth type + * @param Sixth type + * @return Created sextet + */ + @Nonnull + public static Sextet of(@Nonnull final U first, + @Nonnull final V second, + @Nonnull final W third, + @Nonnull final X fourth, + @Nonnull final Y fifth, + @Nonnull final Z sixth) { + return Sextet.of(first, second, third, fourth, fifth, sixth); + } + +} diff --git a/cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/package-info.java b/cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/package-info.java new file mode 100644 index 00000000..4c45dd33 --- /dev/null +++ b/cloud-core/src/main/java/com/intellectualsites/commands/types/tuples/package-info.java @@ -0,0 +1,29 @@ +// +// MIT License +// +// Copyright (c) 2020 Alexander Söderberg +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// + +/** + * Generic immutable n-tuples with non-null values + * for 1 < n ≥ 6 + */ +package com.intellectualsites.commands.types.tuples;