Skip to content

Tuple1, Tuple3, ... , Tuple9 #571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/main/groovy/lang/Tuple1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2003-2014 the original author or authors.
*
* 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 groovy.lang;

/**
* Represents a list of 1 typed Object.
*
* @since 2.4.0
*/
public class Tuple1<T1> extends Tuple {
public Tuple1(T1 first) {
super(new Object[]{first});
}

@SuppressWarnings("unchecked")
public T1 getFirst() {
return (T1) get(0);
}
}
2 changes: 2 additions & 0 deletions src/main/groovy/lang/Tuple2.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

/**
* Represents a list of 2 typed Objects.
*
* @since 2.4.0
*/
public class Tuple2<T1, T2> extends Tuple {
public Tuple2(T1 first, T2 second) {
Expand Down
43 changes: 43 additions & 0 deletions src/main/groovy/lang/Tuple3.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2003-2014 the original author or authors.
*
* 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 groovy.lang;

/**
* Represents a list of 3 typed Objects.
*
* @since 2.4.0
*/
public class Tuple3<T1, T2, T3> extends Tuple {
public Tuple3(T1 first, T2 second, T3 third) {
super(new Object[]{first, second, third});
}

@SuppressWarnings("unchecked")
public T1 getFirst() {
return (T1) get(0);
}

@SuppressWarnings("unchecked")
public T2 getSecond() {
return (T2) get(1);
}

@SuppressWarnings("unchecked")
public T3 getThird() {
return (T3) get(2);
}
}
48 changes: 48 additions & 0 deletions src/main/groovy/lang/Tuple4.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright 2003-2014 the original author or authors.
*
* 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 groovy.lang;

/**
* Represents a list of 4 typed Objects.
*
* @since 2.4.0
*/
public class Tuple4<T1, T2, T3, T4> extends Tuple {
public Tuple4(T1 first, T2 second, T3 third, T4 fourth) {
super(new Object[]{first, second, third, fourth});
}

@SuppressWarnings("unchecked")
public T1 getFirst() {
return (T1) get(0);
}

@SuppressWarnings("unchecked")
public T2 getSecond() {
return (T2) get(1);
}

@SuppressWarnings("unchecked")
public T3 getThird() {
return (T3) get(2);
}

@SuppressWarnings("unchecked")
public T4 getFourth() {
return (T4) get(3);
}
}
53 changes: 53 additions & 0 deletions src/main/groovy/lang/Tuple5.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright 2003-2014 the original author or authors.
*
* 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 groovy.lang;

/**
* Represents a list of 5 typed Objects.
*
* @since 2.4.0
*/
public class Tuple5<T1, T2, T3, T4, T5> extends Tuple {
public Tuple5(T1 first, T2 second, T3 third, T4 fourth, T5 fifth) {
super(new Object[]{first, second, third, fourth, fifth});
}

@SuppressWarnings("unchecked")
public T1 getFirst() {
return (T1) get(0);
}

@SuppressWarnings("unchecked")
public T2 getSecond() {
return (T2) get(1);
}

@SuppressWarnings("unchecked")
public T3 getThird() {
return (T3) get(2);
}

@SuppressWarnings("unchecked")
public T4 getFourth() {
return (T4) get(3);
}

@SuppressWarnings("unchecked")
public T5 getFifth() {
return (T5) get(4);
}
}
58 changes: 58 additions & 0 deletions src/main/groovy/lang/Tuple6.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright 2003-2014 the original author or authors.
*
* 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 groovy.lang;

/**
* Represents a list of 6 typed Objects.
*
* @since 2.4.0
*/
public class Tuple6<T1, T2, T3, T4, T5, T6> extends Tuple {
public Tuple6(T1 first, T2 second, T3 third, T4 fourth, T5 fifth, T6 sixth) {
super(new Object[]{first, second, third, fourth, fifth, sixth});
}

@SuppressWarnings("unchecked")
public T1 getFirst() {
return (T1) get(0);
}

@SuppressWarnings("unchecked")
public T2 getSecond() {
return (T2) get(1);
}

@SuppressWarnings("unchecked")
public T3 getThird() {
return (T3) get(2);
}

@SuppressWarnings("unchecked")
public T4 getFourth() {
return (T4) get(3);
}

@SuppressWarnings("unchecked")
public T5 getFifth() {
return (T5) get(4);
}

@SuppressWarnings("unchecked")
public T6 getSixth() {
return (T6) get(5);
}
}
63 changes: 63 additions & 0 deletions src/main/groovy/lang/Tuple7.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright 2003-2014 the original author or authors.
*
* 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 groovy.lang;

/**
* Represents a list of 7 typed Objects.
*
* @since 2.4.0
*/
public class Tuple7<T1, T2, T3, T4, T5, T6, T7> extends Tuple {
public Tuple7(T1 first, T2 second, T3 third, T4 fourth, T5 fifth, T6 sixth, T7 seventh) {
super(new Object[]{first, second, third, fourth, fifth, sixth, seventh});
}

@SuppressWarnings("unchecked")
public T1 getFirst() {
return (T1) get(0);
}

@SuppressWarnings("unchecked")
public T2 getSecond() {
return (T2) get(1);
}

@SuppressWarnings("unchecked")
public T3 getThird() {
return (T3) get(2);
}

@SuppressWarnings("unchecked")
public T4 getFourth() {
return (T4) get(3);
}

@SuppressWarnings("unchecked")
public T5 getFifth() {
return (T5) get(4);
}

@SuppressWarnings("unchecked")
public T6 getSixth() {
return (T6) get(5);
}

@SuppressWarnings("unchecked")
public T7 getSeventh() {
return (T7) get(6);
}
}
68 changes: 68 additions & 0 deletions src/main/groovy/lang/Tuple8.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright 2003-2014 the original author or authors.
*
* 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 groovy.lang;

/**
* Represents a list of 8 typed Objects.
*
* @since 2.4.0
*/
public class Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> extends Tuple {
public Tuple8(T1 first, T2 second, T3 third, T4 fourth, T5 fifth, T6 sixth, T7 seventh, T8 eighth) {
super(new Object[]{first, second, third, fourth, fifth, sixth, seventh, eighth});
}

@SuppressWarnings("unchecked")
public T1 getFirst() {
return (T1) get(0);
}

@SuppressWarnings("unchecked")
public T2 getSecond() {
return (T2) get(1);
}

@SuppressWarnings("unchecked")
public T3 getThird() {
return (T3) get(2);
}

@SuppressWarnings("unchecked")
public T4 getFourth() {
return (T4) get(3);
}

@SuppressWarnings("unchecked")
public T5 getFifth() {
return (T5) get(4);
}

@SuppressWarnings("unchecked")
public T6 getSixth() {
return (T6) get(5);
}

@SuppressWarnings("unchecked")
public T7 getSeventh() {
return (T7) get(6);
}

@SuppressWarnings("unchecked")
public T8 getEighth() {
return (T8) get(7);
}
}
Loading