com.speedment.common.tuple.Tuples Maven / Gradle / Ivy
Show all versions of tuple Show documentation
/**
*
* Copyright (c) 2006-2019, Speedment, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); You may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.speedment.common.tuple;
import com.speedment.common.tuple.internal.TupleInfiniteDegreeImpl;
import com.speedment.common.tuple.internal.nonnullable.Tuple0Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple10Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple11Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple12Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple13Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple14Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple15Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple16Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple17Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple18Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple19Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple1Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple20Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple21Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple22Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple23Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple2Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple3Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple4Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple5Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple6Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple7Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple8Impl;
import com.speedment.common.tuple.internal.nonnullable.Tuple9Impl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple0MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple10MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple11MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple12MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple13MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple14MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple15MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple16MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple17MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple18MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple19MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple1MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple20MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple21MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple22MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple23MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple2MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple3MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple4MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple5MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple6MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple7MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple8MapperImpl;
import com.speedment.common.tuple.internal.nonnullable.mapper.Tuple9MapperImpl;
import java.util.function.Function;
/**
* A collection of static methods to produce different types of {@link Tuple }
* objects
*
* Generated by com.speedment.sources.pattern.tuple.TuplesPattern
*
* @author Per Minborg
*/
public final class Tuples {
private Tuples() {
throw new UnsupportedOperationException();
}
/**
* Creates and returns a new {@link Tuple0} with the given parameters.
*
* @return a new {@link Tuple0} with the given parameters.
*
* @see Tuple0
* @see Tuple
*/
public static Tuple0 of() {
return Tuple0Impl.EMPTY_TUPLE;
}
/**
* Creates and returns a Function that, when applied, creates a {@link
* Tuple0} from an initial object of type T by applying the given mappers.
*
* @param type of the initial object to be used by the function to
* create a {@link Tuple0 }
* @return a Function that, when applied, creates a {@link Tuple0} from
* an initial object of type T by applying the given mappers.
*
* @see Tuple0
* @see Tuple
*/
@SuppressWarnings("unchecked")
public static Function toTuple() {
return (Function) Tuple0MapperImpl.EMPTY_MAPPER;
}
/**
* Creates and returns a new {@link Tuple1} with the given parameters.
*
* @param type of element 0
* @param e0 element 0
* @return a new {@link Tuple1} with the given parameters.
*
* @see Tuple1
* @see Tuple
*/
public static Tuple1 of(T0 e0) {
return new Tuple1Impl<>(e0);
}
/**
* Creates and returns a Function that, when applied, creates a {@link
* Tuple1} from an initial object of type T by applying the given mappers.
*
* @param type of the initial object to be used by the function to
* create a {@link Tuple1 }
* @param target type of m0
* @param m0 mapper to apply for Tuple1's element 0
* @return a Function that, when applied, creates a {@link Tuple1} from
* an initial object of type T by applying the given mappers.
*
* @see Tuple1
* @see Tuple
*/
public static Function> toTuple(Function m0) {
return new Tuple1MapperImpl<>(m0);
}
/**
* Creates and returns a new {@link Tuple2} with the given parameters.
*
* @param type of element 0
* @param type of element 1
* @param e0 element 0
* @param e1 element 1
* @return a new {@link Tuple2} with the given parameters.
*
* @see Tuple2
* @see Tuple
*/
public static Tuple2 of(T0 e0, T1 e1) {
return new Tuple2Impl<>(e0, e1);
}
/**
* Creates and returns a Function that, when applied, creates a {@link
* Tuple2} from an initial object of type T by applying the given mappers.
*
* @param type of the initial object to be used by the function to
* create a {@link Tuple2 }
* @param target type of m0
* @param target type of m1
* @param m0 mapper to apply for Tuple2's element 0
* @param m1 mapper to apply for Tuple2's element 1
* @return a Function that, when applied, creates a {@link Tuple2} from
* an initial object of type T by applying the given mappers.
*
* @see Tuple2
* @see Tuple
*/
public static Function> toTuple(Function m0, Function m1) {
return new Tuple2MapperImpl<>(m0, m1);
}
/**
* Creates and returns a new {@link Tuple3} with the given parameters.
*
* @param type of element 0
* @param type of element 1
* @param type of element 2
* @param e0 element 0
* @param e1 element 1
* @param e2 element 2
* @return a new {@link Tuple3} with the given parameters.
*
* @see Tuple3
* @see Tuple
*/
public static Tuple3 of(
T0 e0,
T1 e1,
T2 e2) {
return new Tuple3Impl<>(e0, e1, e2);
}
/**
* Creates and returns a Function that, when applied, creates a {@link
* Tuple3} from an initial object of type T by applying the given mappers.
*
* @param type of the initial object to be used by the function to
* create a {@link Tuple3 }
* @param target type of m0
* @param target type of m1
* @param target type of m2
* @param m0 mapper to apply for Tuple3's element 0
* @param m1 mapper to apply for Tuple3's element 1
* @param m2 mapper to apply for Tuple3's element 2
* @return a Function that, when applied, creates a {@link Tuple3} from
* an initial object of type T by applying the given mappers.
*
* @see Tuple3
* @see Tuple
*/
public static Function> toTuple(
Function m0,
Function m1,
Function m2) {
return new Tuple3MapperImpl<>(m0, m1, m2);
}
/**
* Creates and returns a new {@link Tuple4} with the given parameters.
*
* @param type of element 0
* @param type of element 1
* @param type of element 2
* @param type of element 3
* @param e0 element 0
* @param e1 element 1
* @param e2 element 2
* @param e3 element 3
* @return a new {@link Tuple4} with the given parameters.
*
* @see Tuple4
* @see Tuple
*/
public static Tuple4 of(
T0 e0,
T1 e1,
T2 e2,
T3 e3) {
return new Tuple4Impl<>(e0, e1, e2, e3);
}
/**
* Creates and returns a Function that, when applied, creates a {@link
* Tuple4} from an initial object of type T by applying the given mappers.
*
* @param type of the initial object to be used by the function to
* create a {@link Tuple4 }
* @param target type of m0
* @param target type of m1
* @param target type of m2
* @param target type of m3
* @param m0 mapper to apply for Tuple4's element 0
* @param m1 mapper to apply for Tuple4's element 1
* @param m2 mapper to apply for Tuple4's element 2
* @param m3 mapper to apply for Tuple4's element 3
* @return a Function that, when applied, creates a {@link Tuple4} from
* an initial object of type T by applying the given mappers.
*
* @see Tuple4
* @see Tuple
*/
public static Function> toTuple(
Function m0,
Function m1,
Function m2,
Function m3) {
return new Tuple4MapperImpl<>(m0, m1, m2, m3);
}
/**
* Creates and returns a new {@link Tuple5} with the given parameters.
*
* @param type of element 0
* @param type of element 1
* @param type of element 2
* @param type of element 3
* @param type of element 4
* @param e0 element 0
* @param e1 element 1
* @param e2 element 2
* @param e3 element 3
* @param e4 element 4
* @return a new {@link Tuple5} with the given parameters.
*
* @see Tuple5
* @see Tuple
*/
public static Tuple5 of(
T0 e0,
T1 e1,
T2 e2,
T3 e3,
T4 e4) {
return new Tuple5Impl<>(e0, e1, e2, e3, e4);
}
/**
* Creates and returns a Function that, when applied, creates a {@link
* Tuple5} from an initial object of type T by applying the given mappers.
*
* @param type of the initial object to be used by the function to
* create a {@link Tuple5 }
* @param target type of m0
* @param target type of m1
* @param target type of m2
* @param target type of m3
* @param target type of m4
* @param m0 mapper to apply for Tuple5's element 0
* @param m1 mapper to apply for Tuple5's element 1
* @param m2 mapper to apply for Tuple5's element 2
* @param m3 mapper to apply for Tuple5's element 3
* @param m4 mapper to apply for Tuple5's element 4
* @return a Function that, when applied, creates a {@link Tuple5} from
* an initial object of type T by applying the given mappers.
*
* @see Tuple5
* @see Tuple
*/
public static Function> toTuple(
Function m0,
Function m1,
Function m2,
Function m3,
Function m4) {
return new Tuple5MapperImpl<>(m0, m1, m2, m3, m4);
}
/**
* Creates and returns a new {@link Tuple6} with the given parameters.
*
* @param type of element 0
* @param type of element 1
* @param type of element 2
* @param type of element 3
* @param type of element 4
* @param type of element 5
* @param e0 element 0
* @param e1 element 1
* @param e2 element 2
* @param e3 element 3
* @param e4 element 4
* @param e5 element 5
* @return a new {@link Tuple6} with the given parameters.
*
* @see Tuple6
* @see Tuple
*/
public static Tuple6 of(
T0 e0,
T1 e1,
T2 e2,
T3 e3,
T4 e4,
T5 e5) {
return new Tuple6Impl<>(e0, e1, e2, e3, e4, e5);
}
/**
* Creates and returns a Function that, when applied, creates a {@link
* Tuple6} from an initial object of type T by applying the given mappers.
*
* @param type of the initial object to be used by the function to
* create a {@link Tuple6 }
* @param target type of m0
* @param target type of m1
* @param target type of m2
* @param target type of m3
* @param target type of m4
* @param target type of m5
* @param m0 mapper to apply for Tuple6's element 0
* @param m1 mapper to apply for Tuple6's element 1
* @param m2 mapper to apply for Tuple6's element 2
* @param m3 mapper to apply for Tuple6's element 3
* @param m4 mapper to apply for Tuple6's element 4
* @param m5 mapper to apply for Tuple6's element 5
* @return a Function that, when applied, creates a {@link Tuple6} from
* an initial object of type T by applying the given mappers.
*
* @see Tuple6
* @see Tuple
*/
public static Function> toTuple(
Function m0,
Function m1,
Function m2,
Function m3,
Function m4,
Function m5) {
return new Tuple6MapperImpl<>(m0, m1, m2, m3, m4, m5);
}
/**
* Creates and returns a new {@link Tuple7} with the given parameters.
*
* @param type of element 0
* @param type of element 1
* @param type of element 2
* @param type of element 3
* @param type of element 4
* @param type of element 5
* @param type of element 6
* @param e0 element 0
* @param e1 element 1
* @param e2 element 2
* @param e3 element 3
* @param e4 element 4
* @param e5 element 5
* @param e6 element 6
* @return a new {@link Tuple7} with the given parameters.
*
* @see Tuple7
* @see Tuple
*/
public static Tuple7 of(
T0 e0,
T1 e1,
T2 e2,
T3 e3,
T4 e4,
T5 e5,
T6 e6) {
return new Tuple7Impl<>(e0, e1, e2, e3, e4, e5, e6);
}
/**
* Creates and returns a Function that, when applied, creates a {@link
* Tuple7} from an initial object of type T by applying the given mappers.
*
* @param type of the initial object to be used by the function to
* create a {@link Tuple7 }
* @param target type of m0
* @param target type of m1
* @param target type of m2
* @param target type of m3
* @param target type of m4
* @param target type of m5
* @param target type of m6
* @param m0 mapper to apply for Tuple7's element 0
* @param m1 mapper to apply for Tuple7's element 1
* @param m2 mapper to apply for Tuple7's element 2
* @param m3 mapper to apply for Tuple7's element 3
* @param m4 mapper to apply for Tuple7's element 4
* @param m5 mapper to apply for Tuple7's element 5
* @param m6 mapper to apply for Tuple7's element 6
* @return a Function that, when applied, creates a {@link Tuple7} from
* an initial object of type T by applying the given mappers.
*
* @see Tuple7
* @see Tuple
*/
public static Function> toTuple(
Function m0,
Function m1,
Function m2,
Function m3,
Function m4,
Function m5,
Function m6) {
return new Tuple7MapperImpl<>(m0, m1, m2, m3, m4, m5, m6);
}
/**
* Creates and returns a new {@link Tuple8} with the given parameters.
*
* @param type of element 0
* @param type of element 1
* @param type of element 2
* @param type of element 3
* @param type of element 4
* @param type of element 5
* @param type of element 6
* @param type of element 7
* @param e0 element 0
* @param e1 element 1
* @param e2 element 2
* @param e3 element 3
* @param e4 element 4
* @param e5 element 5
* @param e6 element 6
* @param e7 element 7
* @return a new {@link Tuple8} with the given parameters.
*
* @see Tuple8
* @see Tuple
*/
public static Tuple8 of(
T0 e0,
T1 e1,
T2 e2,
T3 e3,
T4 e4,
T5 e5,
T6 e6,
T7 e7) {
return new Tuple8Impl<>(e0, e1, e2, e3, e4, e5, e6, e7);
}
/**
* Creates and returns a Function that, when applied, creates a {@link
* Tuple8} from an initial object of type T by applying the given mappers.
*
* @param type of the initial object to be used by the function to
* create a {@link Tuple8 }
* @param target type of m0
* @param target type of m1
* @param target type of m2
* @param target type of m3
* @param target type of m4
* @param target type of m5
* @param target type of m6
* @param target type of m7
* @param m0 mapper to apply for Tuple8's element 0
* @param m1 mapper to apply for Tuple8's element 1
* @param m2 mapper to apply for Tuple8's element 2
* @param m3 mapper to apply for Tuple8's element 3
* @param m4 mapper to apply for Tuple8's element 4
* @param m5 mapper to apply for Tuple8's element 5
* @param m6 mapper to apply for Tuple8's element 6
* @param m7 mapper to apply for Tuple8's element 7
* @return a Function that, when applied, creates a {@link Tuple8} from
* an initial object of type T by applying the given mappers.
*
* @see Tuple8
* @see Tuple
*/
public static Function> toTuple(
Function m0,
Function m1,
Function m2,
Function m3,
Function m4,
Function m5,
Function m6,
Function m7) {
return new Tuple8MapperImpl<>(m0, m1, m2, m3, m4, m5, m6, m7);
}
/**
* Creates and returns a new {@link Tuple9} with the given parameters.
*
* @param type of element 0
* @param type of element 1
* @param type of element 2
* @param type of element 3
* @param type of element 4
* @param type of element 5
* @param type of element 6
* @param type of element 7
* @param type of element 8
* @param e0 element 0
* @param e1 element 1
* @param e2 element 2
* @param e3 element 3
* @param e4 element 4
* @param e5 element 5
* @param e6 element 6
* @param e7 element 7
* @param e8 element 8
* @return a new {@link Tuple9} with the given parameters.
*
* @see Tuple9
* @see Tuple
*/
public static Tuple9 of(
T0 e0,
T1 e1,
T2 e2,
T3 e3,
T4 e4,
T5 e5,
T6 e6,
T7 e7,
T8 e8) {
return new Tuple9Impl<>(e0, e1, e2, e3, e4, e5, e6, e7, e8);
}
/**
* Creates and returns a Function that, when applied, creates a {@link
* Tuple9} from an initial object of type T by applying the given mappers.
*
* @param type of the initial object to be used by the function to
* create a {@link Tuple9 }
* @param target type of m0
* @param target type of m1
* @param target type of m2
* @param target type of m3
* @param target type of m4
* @param target type of m5
* @param target type of m6
* @param target type of m7
* @param target type of m8
* @param m0 mapper to apply for Tuple9's element 0
* @param m1 mapper to apply for Tuple9's element 1
* @param m2 mapper to apply for Tuple9's element 2
* @param m3 mapper to apply for Tuple9's element 3
* @param m4 mapper to apply for Tuple9's element 4
* @param m5 mapper to apply for Tuple9's element 5
* @param m6 mapper to apply for Tuple9's element 6
* @param m7 mapper to apply for Tuple9's element 7
* @param m8 mapper to apply for Tuple9's element 8
* @return a Function that, when applied, creates a {@link Tuple9} from
* an initial object of type T by applying the given mappers.
*
* @see Tuple9
* @see Tuple
*/
public static Function> toTuple(
Function m0,
Function m1,
Function m2,
Function m3,
Function m4,
Function m5,
Function m6,
Function m7,
Function m8) {
return new Tuple9MapperImpl<>(m0, m1, m2, m3, m4, m5, m6, m7, m8);
}
/**
* Creates and returns a new {@link Tuple10} with the given parameters.
*
* @param type of element 0
* @param type of element 1
* @param type of element 2
* @param type of element 3
* @param type of element 4
* @param type of element 5
* @param type of element 6
* @param type of element 7
* @param type of element 8
* @param type of element 9
* @param e0 element 0
* @param e1 element 1
* @param e2 element 2
* @param e3 element 3
* @param e4 element 4
* @param e5 element 5
* @param e6 element 6
* @param e7 element 7
* @param e8 element 8
* @param e9 element 9
* @return a new {@link Tuple10} with the given parameters.
*
* @see Tuple10
* @see Tuple
*/
public static Tuple10 of(
T0 e0,
T1 e1,
T2 e2,
T3 e3,
T4 e4,
T5 e5,
T6 e6,
T7 e7,
T8 e8,
T9 e9) {
return new Tuple10Impl<>(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9);
}
/**
* Creates and returns a Function that, when applied, creates a {@link
* Tuple10} from an initial object of type T by applying the given mappers.
*
* @param type of the initial object to be used by the function to
* create a {@link Tuple10 }
* @param target type of m0
* @param target type of m1
* @param target type of m2
* @param target type of m3
* @param target type of m4
* @param target type of m5
* @param target type of m6
* @param target type of m7
* @param target type of m8
* @param target type of m9
* @param m0 mapper to apply for Tuple10's element 0
* @param m1 mapper to apply for Tuple10's element 1
* @param m2 mapper to apply for Tuple10's element 2
* @param m3 mapper to apply for Tuple10's element 3
* @param m4 mapper to apply for Tuple10's element 4
* @param m5 mapper to apply for Tuple10's element 5
* @param m6 mapper to apply for Tuple10's element 6
* @param m7 mapper to apply for Tuple10's element 7
* @param m8 mapper to apply for Tuple10's element 8
* @param m9 mapper to apply for Tuple10's element 9
* @return a Function that, when applied, creates a {@link Tuple10} from
* an initial object of type T by applying the given mappers.
*
* @see Tuple10
* @see Tuple
*/
public static Function> toTuple(
Function m0,
Function m1,
Function m2,
Function m3,
Function m4,
Function m5,
Function m6,
Function m7,
Function m8,
Function m9) {
return new Tuple10MapperImpl<>(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9);
}
/**
* Creates and returns a new {@link Tuple11} with the given parameters.
*
* @param type of element 0
* @param type of element 1
* @param type of element 2
* @param type of element 3
* @param type of element 4
* @param type of element 5
* @param type of element 6
* @param type of element 7
* @param type of element 8
* @param type of element 9
* @param type of element 10
* @param e0 element 0
* @param e1 element 1
* @param e2 element 2
* @param e3 element 3
* @param e4 element 4
* @param e5 element 5
* @param e6 element 6
* @param e7 element 7
* @param e8 element 8
* @param e9 element 9
* @param e10 element 10
* @return a new {@link Tuple11} with the given parameters.
*
* @see Tuple11
* @see Tuple
*/
public static Tuple11 of(
T0 e0,
T1 e1,
T2 e2,
T3 e3,
T4 e4,
T5 e5,
T6 e6,
T7 e7,
T8 e8,
T9 e9,
T10 e10) {
return new Tuple11Impl<>(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10);
}
/**
* Creates and returns a Function that, when applied, creates a {@link
* Tuple11} from an initial object of type T by applying the given mappers.
*
* @param type of the initial object to be used by the function to
* create a {@link Tuple11 }
* @param target type of m0
* @param target type of m1
* @param target type of m2
* @param target type of m3
* @param target type of m4
* @param target type of m5
* @param target type of m6
* @param target type of m7
* @param target type of m8
* @param target type of m9
* @param target type of m10
* @param m0 mapper to apply for Tuple11's element 0
* @param m1 mapper to apply for Tuple11's element 1
* @param m2 mapper to apply for Tuple11's element 2
* @param m3 mapper to apply for Tuple11's element 3
* @param m4 mapper to apply for Tuple11's element 4
* @param m5 mapper to apply for Tuple11's element 5
* @param m6 mapper to apply for Tuple11's element 6
* @param m7 mapper to apply for Tuple11's element 7
* @param m8 mapper to apply for Tuple11's element 8
* @param m9 mapper to apply for Tuple11's element 9
* @param m10 mapper to apply for Tuple11's element 10
* @return a Function that, when applied, creates a {@link Tuple11}
* from an initial object of type T by applying the given
* mappers.
*
* @see Tuple11
* @see Tuple
*/
public static Function> toTuple(
Function m0,
Function m1,
Function m2,
Function m3,
Function