├── sample ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ └── layout │ │ │ └── activity_main.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── bartoszlipinski │ │ └── groupofx │ │ └── sample │ │ └── activity │ │ └── MainActivity.java ├── proguard-rules.pro └── build.gradle ├── groupofx ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── bartoszlipinski │ │ │ └── groupofx │ │ │ └── Group.java │ └── test │ │ └── java │ │ └── com │ │ └── bartoszlipinski │ │ └── groupofx │ │ ├── GroupOfTwoTest.java │ │ ├── GroupOfThreeTest.java │ │ ├── GroupOfFourTest.java │ │ ├── GroupOfFiveTest.java │ │ ├── GroupOfSixTest.java │ │ ├── GroupOfSevenTest.java │ │ ├── GroupOfEightTest.java │ │ ├── GroupOfNineTest.java │ │ └── GroupOfTenTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── CHANGELOG.md ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── USAGE.md ├── gradle.properties ├── README.md ├── gradlew.bat ├── gradlew └── LICENSE /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /groupofx/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':groupofx', ':sample' 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Version 1.0.0 *(2016-06-13)* 2 | ---------------------------- 3 | 4 | Initial release. -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blipinsk/GroupOfX/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /groupofx/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | GroupOfX 3 | 4 | -------------------------------------------------------------------------------- /sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | GroupOfX 3 | 4 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blipinsk/GroupOfX/HEAD/sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blipinsk/GroupOfX/HEAD/sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blipinsk/GroupOfX/HEAD/sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blipinsk/GroupOfX/HEAD/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /groupofx/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .classpath 2 | .project 3 | .settings 4 | eclipsebin 5 | 6 | bin 7 | gen 8 | build 9 | out 10 | lib 11 | 12 | .idea 13 | *.iml 14 | classes 15 | 16 | obj 17 | 18 | .DS_Store 19 | 20 | # Gradle 21 | .gradle 22 | jniLibs 23 | build 24 | local.properties 25 | reports 26 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon May 23 22:05:16 CEST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip 7 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | -------------------------------------------------------------------------------- /USAGE.md: -------------------------------------------------------------------------------- 1 | Usage 2 | ===== 3 | *For a working implementation of this library see the `sample/` folder.* 4 | 5 | Create and use `Group.OfX` (where `X ∈ {Two, Three, Four, ..., Ten}`) just like you would a `Pair` object. 6 | 7 | ```java 8 | Group.OfFour aGroupOfFour = 9 | new Group.OfFour<>("first part", 2, "third", "and a fourth one."); 10 | ``` 11 | 12 | Including In Your Project 13 | ------------------------- 14 | You can grab the library via Maven Central. Just add a proper dependency inside your `build.gradle`. Like this: 15 | 16 | ```xml 17 | dependencies { 18 | compile 'com.bartoszlipinski:groupofx:1.0.0' 19 | } 20 | ``` 21 | -------------------------------------------------------------------------------- /sample/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Applications/ADT/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /groupofx/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Applications/ADT/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | def cfg = rootProject.ext.configuration 4 | 5 | dependencies { 6 | compile fileTree(dir: 'libs', include: ['*.jar']) 7 | compile project(':groupofx') 8 | compile 'com.android.support:appcompat-v7:23.4.0' 9 | } 10 | 11 | android { 12 | compileSdkVersion cfg.compileVersion 13 | buildToolsVersion cfg.buildToolsVersion 14 | 15 | defaultConfig { 16 | applicationId cfg.package 17 | minSdkVersion 7 18 | targetSdkVersion cfg.targetSdk 19 | versionCode cfg.versionCode 20 | versionName cfg.versionName 21 | } 22 | buildTypes { 23 | release { 24 | minifyEnabled false 25 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /groupofx/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.novoda.bintray-release' 3 | 4 | def cfg = rootProject.ext.configuration 5 | def bintrayCfg = rootProject.ext.bintrayConfig 6 | 7 | android { 8 | compileSdkVersion cfg.compileVersion 9 | buildToolsVersion cfg.buildToolsVersion 10 | 11 | defaultConfig { 12 | minSdkVersion cfg.minSdk 13 | targetSdkVersion cfg.targetSdk 14 | versionCode cfg.versionCode 15 | versionName cfg.versionName 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | } 24 | 25 | dependencies { 26 | testCompile "junit:junit:4.12" 27 | testCompile "com.google.truth:truth:0.28" 28 | } 29 | 30 | publish { 31 | artifactId = bintrayCfg.artifact 32 | userOrg = bintrayCfg.userOrg 33 | groupId = bintrayCfg.groupId 34 | uploadName = bintrayCfg.name 35 | publishVersion = cfg.versionName 36 | desc = bintrayCfg.description 37 | website = bintrayCfg.website 38 | licences = bintrayCfg.licences 39 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DEPRECATED 2 | 3 | Well... it's pretty much pointless 😅. 4 | 5 | No new development will be taking place. This library will not be maintained. 6 | 7 | Thanks for all the support!!! 8 | 9 | ## GroupOfX 10 | 11 | When Android's Pair class is just not enough. 12 | 13 | I use Android's Pair class quite often, but sometimes packing two objects is just not enough. 14 | 15 | ## Usage 16 | 17 | Check [USAGE.md](USAGE.md) 18 | 19 | Developed by 20 | ============ 21 | * Bartosz Lipinski 22 | 23 | License 24 | ======= 25 | 26 | Copyright 2016 Bartosz Lipiński 27 | 28 | Licensed under the Apache License, Version 2.0 (the "License"); 29 | you may not use this file except in compliance with the License. 30 | You may obtain a copy of the License at 31 | 32 | http://www.apache.org/licenses/LICENSE-2.0 33 | 34 | Unless required by applicable law or agreed to in writing, software 35 | distributed under the License is distributed on an "AS IS" BASIS, 36 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 37 | See the License for the specific language governing permissions and 38 | limitations under the License. 39 | -------------------------------------------------------------------------------- /sample/src/main/java/com/bartoszlipinski/groupofx/sample/activity/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.bartoszlipinski.groupofx.sample.activity; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | 6 | import com.bartoszlipinski.groupofx.Group; 7 | import com.bartoszlipinski.groupofx.sample.R; 8 | 9 | /** 10 | * Created by Bartosz Lipinski 11 | */ 12 | public class MainActivity extends Activity { 13 | 14 | @Override 15 | protected void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | setContentView(R.layout.activity_main); 18 | 19 | Group.OfTwo aGroupOfTwo = 20 | new Group.OfTwo<>("This is a group of", 2); 21 | Group.OfThree aGroupOfThree = 22 | new Group.OfThree<>(aGroupOfTwo.first, aGroupOfTwo.second + 1, "this is a third argument."); 23 | Group.OfFour aGroupOfFour = 24 | new Group.OfFour<>(aGroupOfTwo.first, aGroupOfThree.second + 1, "third", "and fourth argument."); 25 | Group.OfFive aGroupOfFive = 26 | new Group.OfFive<>(aGroupOfTwo.first, aGroupOfFour.second + 1, aGroupOfFour.third, "fourth", 27 | "and fifth argument. Do you really need more than that?"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /groupofx/src/test/java/com/bartoszlipinski/groupofx/GroupOfTwoTest.java: -------------------------------------------------------------------------------- 1 | package com.bartoszlipinski.groupofx; 2 | 3 | import org.junit.Test; 4 | 5 | import static com.google.common.truth.Truth.assertThat; 6 | 7 | /** 8 | * Created by Bartosz Lipinski 9 | * 13.06.2016 10 | */ 11 | public class GroupOfTwoTest { 12 | 13 | @Test 14 | public void testCreate() throws Exception { 15 | Group.OfTwo group = new Group.OfTwo<>(1, "second"); 16 | assertThat(group.first).isEqualTo(1); 17 | assertThat(group.second).isEqualTo("second"); 18 | 19 | group = Group.OfTwo.create(1, "second"); 20 | assertThat(group.first).isEqualTo(1); 21 | assertThat(group.second).isEqualTo("second"); 22 | } 23 | 24 | @Test 25 | public void testEqualsAndHashcode() throws Exception { 26 | Group.OfTwo groupOne = new Group.OfTwo<>(1, "second"); 27 | Group.OfTwo groupTwo = new Group.OfTwo<>(1, "second"); 28 | 29 | assertThat(groupOne.equals(groupTwo)).isTrue(); 30 | assertThat(groupOne.hashCode()).isEqualTo(groupTwo.hashCode()); 31 | 32 | //all different 33 | groupTwo.first = 2; 34 | groupTwo.second = "not_second"; 35 | assertThat(groupOne.equals(groupTwo)).isFalse(); 36 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 37 | 38 | //one different 39 | groupTwo.first = 1; 40 | groupTwo.second = "not_second"; 41 | assertThat(groupOne.equals(groupTwo)).isFalse(); 42 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 43 | 44 | groupTwo.first = 2; 45 | groupTwo.second = "second"; 46 | assertThat(groupOne.equals(groupTwo)).isFalse(); 47 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 48 | } 49 | } -------------------------------------------------------------------------------- /groupofx/src/test/java/com/bartoszlipinski/groupofx/GroupOfThreeTest.java: -------------------------------------------------------------------------------- 1 | package com.bartoszlipinski.groupofx; 2 | 3 | import org.junit.Test; 4 | 5 | import static com.google.common.truth.Truth.assertThat; 6 | 7 | /** 8 | * Created by Bartosz Lipinski 9 | * 13.06.2016 10 | */ 11 | public class GroupOfThreeTest { 12 | 13 | @SuppressWarnings("deprecation") 14 | @Test 15 | public void testCreate() throws Exception { 16 | Group.OfThree group = new Group.OfThree<>(1, "second", 3.1f); 17 | assertThat(group.first).isEqualTo(1); 18 | assertThat(group.second).isEqualTo("second"); 19 | assertThat(group.third).isEqualTo(3.1f); 20 | 21 | group = Group.OfThree.create(1, "second", 3.1f); 22 | assertThat(group.first).isEqualTo(1); 23 | assertThat(group.second).isEqualTo("second"); 24 | assertThat(group.third).isEqualTo(3.1f); 25 | } 26 | 27 | @Test 28 | public void testEqualsAndHashcode() throws Exception { 29 | Group.OfThree groupOne = new Group.OfThree<>(1, "second", 3.1f); 30 | Group.OfThree groupTwo = new Group.OfThree<>(1, "second", 3.1f); 31 | 32 | assertThat(groupOne.equals(groupTwo)).isTrue(); 33 | assertThat(groupOne.hashCode()).isEqualTo(groupTwo.hashCode()); 34 | 35 | //all different 36 | groupTwo.first = 2; 37 | groupTwo.second = "not_second"; 38 | groupTwo.third = 3.2f; 39 | assertThat(groupOne.equals(groupTwo)).isFalse(); 40 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 41 | 42 | //one different 43 | groupTwo.first = 1; 44 | groupTwo.second = "not_second"; 45 | groupTwo.third = 3.1f; 46 | assertThat(groupOne.equals(groupTwo)).isFalse(); 47 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 48 | 49 | groupTwo.first = 2; 50 | groupTwo.second = "second"; 51 | groupTwo.third = 3.1f; 52 | assertThat(groupOne.equals(groupTwo)).isFalse(); 53 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 54 | 55 | groupTwo.first = 1; 56 | groupTwo.second = "second"; 57 | groupTwo.third = 3.2f; 58 | assertThat(groupOne.equals(groupTwo)).isFalse(); 59 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 60 | } 61 | 62 | } -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /groupofx/src/test/java/com/bartoszlipinski/groupofx/GroupOfFourTest.java: -------------------------------------------------------------------------------- 1 | package com.bartoszlipinski.groupofx; 2 | 3 | import org.junit.Test; 4 | 5 | import static com.google.common.truth.Truth.assertThat; 6 | 7 | /** 8 | * Created by Bartosz Lipinski 9 | * 13.06.2016 10 | */ 11 | public class GroupOfFourTest { 12 | 13 | @SuppressWarnings("deprecation") 14 | @Test 15 | public void testCreate() throws Exception { 16 | Group.OfFour group = 17 | new Group.OfFour<>(1, "second", 3.1f, 4.2); 18 | assertThat(group.first).isEqualTo(1); 19 | assertThat(group.second).isEqualTo("second"); 20 | assertThat(group.third).isEqualTo(3.1f); 21 | assertThat(group.fourth).isEqualTo(4.2); 22 | 23 | group = 24 | Group.OfFour.create(1, "second", 3.1f, 4.2); 25 | assertThat(group.first).isEqualTo(1); 26 | assertThat(group.second).isEqualTo("second"); 27 | assertThat(group.third).isEqualTo(3.1f); 28 | assertThat(group.fourth).isEqualTo(4.2); 29 | } 30 | 31 | @Test 32 | public void testEqualsAndHashcode() throws Exception { 33 | Group.OfFour groupOne = 34 | new Group.OfFour<>(1, "second", 3.1f, 4.2); 35 | Group.OfFour groupTwo = 36 | new Group.OfFour<>(1, "second", 3.1f, 4.2); 37 | 38 | assertThat(groupOne.equals(groupTwo)).isTrue(); 39 | assertThat(groupOne.hashCode()).isEqualTo(groupTwo.hashCode()); 40 | 41 | //all different 42 | groupTwo.first = 2; 43 | groupTwo.second = "not_second"; 44 | groupTwo.third = 3.2f; 45 | groupTwo.fourth = 4.3; 46 | assertThat(groupOne.equals(groupTwo)).isFalse(); 47 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 48 | 49 | //one different 50 | groupTwo.first = 1; 51 | groupTwo.second = "not_second"; 52 | groupTwo.third = 3.1f; 53 | groupTwo.fourth = 4.2; 54 | assertThat(groupOne.equals(groupTwo)).isFalse(); 55 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 56 | 57 | groupTwo.first = 2; 58 | groupTwo.second = "second"; 59 | groupTwo.third = 3.1f; 60 | groupTwo.fourth = 4.2; 61 | assertThat(groupOne.equals(groupTwo)).isFalse(); 62 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 63 | 64 | groupTwo.first = 1; 65 | groupTwo.second = "second"; 66 | groupTwo.third = 3.2f; 67 | groupTwo.fourth = 4.2; 68 | assertThat(groupOne.equals(groupTwo)).isFalse(); 69 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 70 | 71 | groupTwo.first = 1; 72 | groupTwo.second = "second"; 73 | groupTwo.third = 3.1f; 74 | groupTwo.fourth = 4.3; 75 | assertThat(groupOne.equals(groupTwo)).isFalse(); 76 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 77 | } 78 | 79 | } -------------------------------------------------------------------------------- /groupofx/src/test/java/com/bartoszlipinski/groupofx/GroupOfFiveTest.java: -------------------------------------------------------------------------------- 1 | package com.bartoszlipinski.groupofx; 2 | 3 | import org.junit.Test; 4 | 5 | import static com.google.common.truth.Truth.assertThat; 6 | 7 | /** 8 | * Created by Bartosz Lipinski 9 | * 13.06.2016 10 | */ 11 | public class GroupOfFiveTest { 12 | 13 | @SuppressWarnings("deprecation") 14 | @Test 15 | public void testCreate() throws Exception { 16 | Group.OfFive group = 17 | new Group.OfFive<>(1, "second", 3.1f, 4.2, 5000L); 18 | assertThat(group.first).isEqualTo(1); 19 | assertThat(group.second).isEqualTo("second"); 20 | assertThat(group.third).isEqualTo(3.1f); 21 | assertThat(group.fourth).isEqualTo(4.2); 22 | assertThat(group.fifth).isEqualTo(5000L); 23 | 24 | group = 25 | Group.OfFive.create(1, "second", 3.1f, 4.2, 5000L); 26 | assertThat(group.first).isEqualTo(1); 27 | assertThat(group.second).isEqualTo("second"); 28 | assertThat(group.third).isEqualTo(3.1f); 29 | assertThat(group.fourth).isEqualTo(4.2); 30 | assertThat(group.fifth).isEqualTo(5000L); 31 | } 32 | 33 | @Test 34 | public void testEqualsAndHashcode() throws Exception { 35 | Group.OfFive groupOne = 36 | new Group.OfFive<>(1, "second", 3.1f, 4.2, 5000L); 37 | Group.OfFive groupTwo = 38 | new Group.OfFive<>(1, "second", 3.1f, 4.2, 5000L); 39 | 40 | assertThat(groupOne.equals(groupTwo)).isTrue(); 41 | assertThat(groupOne.hashCode()).isEqualTo(groupTwo.hashCode()); 42 | 43 | //all different 44 | groupTwo.first = 2; 45 | groupTwo.second = "not_second"; 46 | groupTwo.third = 3.2f; 47 | groupTwo.fourth = 4.3; 48 | groupTwo.fifth = 5001L; 49 | assertThat(groupOne.equals(groupTwo)).isFalse(); 50 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 51 | 52 | //one different 53 | groupTwo.first = 1; 54 | groupTwo.second = "not_second"; 55 | groupTwo.third = 3.1f; 56 | groupTwo.fourth = 4.2; 57 | groupTwo.fifth = 5000L; 58 | assertThat(groupOne.equals(groupTwo)).isFalse(); 59 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 60 | 61 | groupTwo.first = 2; 62 | groupTwo.second = "second"; 63 | groupTwo.third = 3.1f; 64 | groupTwo.fourth = 4.2; 65 | groupTwo.fifth = 5000L; 66 | assertThat(groupOne.equals(groupTwo)).isFalse(); 67 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 68 | 69 | groupTwo.first = 1; 70 | groupTwo.second = "second"; 71 | groupTwo.third = 3.2f; 72 | groupTwo.fourth = 4.2; 73 | groupTwo.fifth = 5000L; 74 | assertThat(groupOne.equals(groupTwo)).isFalse(); 75 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 76 | 77 | groupTwo.first = 1; 78 | groupTwo.second = "second"; 79 | groupTwo.third = 3.1f; 80 | groupTwo.fourth = 4.3; 81 | groupTwo.fifth = 5000L; 82 | assertThat(groupOne.equals(groupTwo)).isFalse(); 83 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 84 | 85 | groupTwo.first = 1; 86 | groupTwo.second = "second"; 87 | groupTwo.third = 3.1f; 88 | groupTwo.fourth = 4.2; 89 | groupTwo.fifth = 5001L; 90 | assertThat(groupOne.equals(groupTwo)).isFalse(); 91 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 92 | } 93 | 94 | } -------------------------------------------------------------------------------- /groupofx/src/test/java/com/bartoszlipinski/groupofx/GroupOfSixTest.java: -------------------------------------------------------------------------------- 1 | package com.bartoszlipinski.groupofx; 2 | 3 | import org.junit.Test; 4 | 5 | import static com.google.common.truth.Truth.assertThat; 6 | 7 | /** 8 | * Created by Bartosz Lipinski 9 | * 13.06.2016 10 | */ 11 | public class GroupOfSixTest { 12 | 13 | @SuppressWarnings("deprecation") 14 | @Test 15 | public void testCreate() throws Exception { 16 | Group.OfSix group = 17 | new Group.OfSix<>(1, "second", 3.1f, 4.2, 5000L, 6); 18 | assertThat(group.first).isEqualTo(1); 19 | assertThat(group.second).isEqualTo("second"); 20 | assertThat(group.third).isEqualTo(3.1f); 21 | assertThat(group.fourth).isEqualTo(4.2); 22 | assertThat(group.fifth).isEqualTo(5000L); 23 | assertThat(group.sixth).isEqualTo(6); 24 | 25 | group = 26 | Group.OfSix.create(1, "second", 3.1f, 4.2, 5000L, 6); 27 | assertThat(group.first).isEqualTo(1); 28 | assertThat(group.second).isEqualTo("second"); 29 | assertThat(group.third).isEqualTo(3.1f); 30 | assertThat(group.fourth).isEqualTo(4.2); 31 | assertThat(group.fifth).isEqualTo(5000L); 32 | assertThat(group.sixth).isEqualTo(6); 33 | } 34 | 35 | @Test 36 | public void testEqualsAndHashcode() throws Exception { 37 | Group.OfSix groupOne = 38 | new Group.OfSix<>(1, "second", 3.1f, 4.2, 5000L, 6); 39 | Group.OfSix groupTwo = 40 | new Group.OfSix<>(1, "second", 3.1f, 4.2, 5000L, 6); 41 | 42 | assertThat(groupOne.equals(groupTwo)).isTrue(); 43 | assertThat(groupOne.hashCode()).isEqualTo(groupTwo.hashCode()); 44 | 45 | //all different 46 | groupTwo.first = 2; 47 | groupTwo.second = "not_second"; 48 | groupTwo.third = 3.2f; 49 | groupTwo.fourth = 4.3; 50 | groupTwo.fifth = 5001L; 51 | groupTwo.sixth = 7; 52 | assertThat(groupOne.equals(groupTwo)).isFalse(); 53 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 54 | 55 | //one different 56 | groupTwo.first = 1; 57 | groupTwo.second = "not_second"; 58 | groupTwo.third = 3.1f; 59 | groupTwo.fourth = 4.2; 60 | groupTwo.fifth = 5000L; 61 | groupTwo.sixth = 6; 62 | assertThat(groupOne.equals(groupTwo)).isFalse(); 63 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 64 | 65 | groupTwo.first = 2; 66 | groupTwo.second = "second"; 67 | groupTwo.third = 3.1f; 68 | groupTwo.fourth = 4.2; 69 | groupTwo.fifth = 5000L; 70 | groupTwo.sixth = 6; 71 | assertThat(groupOne.equals(groupTwo)).isFalse(); 72 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 73 | 74 | groupTwo.first = 1; 75 | groupTwo.second = "second"; 76 | groupTwo.third = 3.2f; 77 | groupTwo.fourth = 4.2; 78 | groupTwo.fifth = 5000L; 79 | groupTwo.sixth = 6; 80 | assertThat(groupOne.equals(groupTwo)).isFalse(); 81 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 82 | 83 | groupTwo.first = 1; 84 | groupTwo.second = "second"; 85 | groupTwo.third = 3.1f; 86 | groupTwo.fourth = 4.3; 87 | groupTwo.fifth = 5000L; 88 | groupTwo.sixth = 6; 89 | assertThat(groupOne.equals(groupTwo)).isFalse(); 90 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 91 | 92 | groupTwo.first = 1; 93 | groupTwo.second = "second"; 94 | groupTwo.third = 3.1f; 95 | groupTwo.fourth = 4.2; 96 | groupTwo.fifth = 5001L; 97 | groupTwo.sixth = 6; 98 | assertThat(groupOne.equals(groupTwo)).isFalse(); 99 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 100 | 101 | groupTwo.first = 1; 102 | groupTwo.second = "second"; 103 | groupTwo.third = 3.1f; 104 | groupTwo.fourth = 4.2; 105 | groupTwo.fifth = 5000L; 106 | groupTwo.sixth = 7; 107 | assertThat(groupOne.equals(groupTwo)).isFalse(); 108 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 109 | } 110 | } -------------------------------------------------------------------------------- /groupofx/src/test/java/com/bartoszlipinski/groupofx/GroupOfSevenTest.java: -------------------------------------------------------------------------------- 1 | package com.bartoszlipinski.groupofx; 2 | 3 | import org.junit.Test; 4 | 5 | import static com.google.common.truth.Truth.assertThat; 6 | 7 | /** 8 | * Created by Bartosz Lipinski 9 | * 13.06.2016 10 | */ 11 | public class GroupOfSevenTest { 12 | 13 | @SuppressWarnings("deprecation") 14 | @Test 15 | public void testCreate() throws Exception { 16 | Group.OfSeven group = 17 | new Group.OfSeven<>(1, "second", 3.1f, 4.2, 5000L, 6, "seventh"); 18 | assertThat(group.first).isEqualTo(1); 19 | assertThat(group.second).isEqualTo("second"); 20 | assertThat(group.third).isEqualTo(3.1f); 21 | assertThat(group.fourth).isEqualTo(4.2); 22 | assertThat(group.fifth).isEqualTo(5000L); 23 | assertThat(group.sixth).isEqualTo(6); 24 | assertThat(group.seventh).isEqualTo("seventh"); 25 | 26 | group = 27 | Group.OfSeven.create(1, "second", 3.1f, 4.2, 5000L, 6, "seventh"); 28 | assertThat(group.first).isEqualTo(1); 29 | assertThat(group.second).isEqualTo("second"); 30 | assertThat(group.third).isEqualTo(3.1f); 31 | assertThat(group.fourth).isEqualTo(4.2); 32 | assertThat(group.fifth).isEqualTo(5000L); 33 | assertThat(group.sixth).isEqualTo(6); 34 | assertThat(group.seventh).isEqualTo("seventh"); 35 | } 36 | 37 | @Test 38 | public void testEqualsAndHashcode() throws Exception { 39 | Group.OfSeven groupOne = 40 | new Group.OfSeven<>(1, "second", 3.1f, 4.2, 5000L, 6, "seventh"); 41 | Group.OfSeven groupTwo = 42 | new Group.OfSeven<>(1, "second", 3.1f, 4.2, 5000L, 6, "seventh"); 43 | 44 | assertThat(groupOne.equals(groupTwo)).isTrue(); 45 | assertThat(groupOne.hashCode()).isEqualTo(groupTwo.hashCode()); 46 | 47 | //all different 48 | groupTwo.first = 2; 49 | groupTwo.second = "not_second"; 50 | groupTwo.third = 3.2f; 51 | groupTwo.fourth = 4.3; 52 | groupTwo.fifth = 5001L; 53 | groupTwo.sixth = 7; 54 | groupTwo.seventh = "not_seventh"; 55 | assertThat(groupOne.equals(groupTwo)).isFalse(); 56 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 57 | 58 | //one different 59 | groupTwo.first = 1; 60 | groupTwo.second = "not_second"; 61 | groupTwo.third = 3.1f; 62 | groupTwo.fourth = 4.2; 63 | groupTwo.fifth = 5000L; 64 | groupTwo.sixth = 6; 65 | groupTwo.seventh = "seventh"; 66 | assertThat(groupOne.equals(groupTwo)).isFalse(); 67 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 68 | 69 | groupTwo.first = 2; 70 | groupTwo.second = "second"; 71 | groupTwo.third = 3.1f; 72 | groupTwo.fourth = 4.2; 73 | groupTwo.fifth = 5000L; 74 | groupTwo.sixth = 6; 75 | groupTwo.seventh = "seventh"; 76 | assertThat(groupOne.equals(groupTwo)).isFalse(); 77 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 78 | 79 | groupTwo.first = 1; 80 | groupTwo.second = "second"; 81 | groupTwo.third = 3.2f; 82 | groupTwo.fourth = 4.2; 83 | groupTwo.fifth = 5000L; 84 | groupTwo.sixth = 6; 85 | groupTwo.seventh = "seventh"; 86 | assertThat(groupOne.equals(groupTwo)).isFalse(); 87 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 88 | 89 | groupTwo.first = 1; 90 | groupTwo.second = "second"; 91 | groupTwo.third = 3.1f; 92 | groupTwo.fourth = 4.3; 93 | groupTwo.fifth = 5000L; 94 | groupTwo.sixth = 6; 95 | groupTwo.seventh = "seventh"; 96 | assertThat(groupOne.equals(groupTwo)).isFalse(); 97 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 98 | 99 | groupTwo.first = 1; 100 | groupTwo.second = "second"; 101 | groupTwo.third = 3.1f; 102 | groupTwo.fourth = 4.2; 103 | groupTwo.fifth = 5001L; 104 | groupTwo.sixth = 6; 105 | groupTwo.seventh = "seventh"; 106 | assertThat(groupOne.equals(groupTwo)).isFalse(); 107 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 108 | 109 | groupTwo.first = 1; 110 | groupTwo.second = "second"; 111 | groupTwo.third = 3.1f; 112 | groupTwo.fourth = 4.2; 113 | groupTwo.fifth = 5000L; 114 | groupTwo.sixth = 7; 115 | groupTwo.seventh = "seventh"; 116 | assertThat(groupOne.equals(groupTwo)).isFalse(); 117 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 118 | 119 | groupTwo.first = 1; 120 | groupTwo.second = "second"; 121 | groupTwo.third = 3.1f; 122 | groupTwo.fourth = 4.2; 123 | groupTwo.fifth = 5000L; 124 | groupTwo.sixth = 6; 125 | groupTwo.seventh = "not_seventh"; 126 | assertThat(groupOne.equals(groupTwo)).isFalse(); 127 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 128 | } 129 | } -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /groupofx/src/test/java/com/bartoszlipinski/groupofx/GroupOfEightTest.java: -------------------------------------------------------------------------------- 1 | package com.bartoszlipinski.groupofx; 2 | 3 | import org.junit.Test; 4 | 5 | import static com.google.common.truth.Truth.assertThat; 6 | 7 | /** 8 | * Created by Bartosz Lipinski 9 | * 13.06.2016 10 | */ 11 | public class GroupOfEightTest { 12 | 13 | @SuppressWarnings("deprecation") 14 | @Test 15 | public void testCreate() throws Exception { 16 | Group.OfEight group = 17 | new Group.OfEight<>(1, "second", 3.1f, 4.2, 5000L, 6, "seventh", 8.7f); 18 | assertThat(group.first).isEqualTo(1); 19 | assertThat(group.second).isEqualTo("second"); 20 | assertThat(group.third).isEqualTo(3.1f); 21 | assertThat(group.fourth).isEqualTo(4.2); 22 | assertThat(group.fifth).isEqualTo(5000L); 23 | assertThat(group.sixth).isEqualTo(6); 24 | assertThat(group.seventh).isEqualTo("seventh"); 25 | assertThat(group.eighth).isEqualTo(8.7f); 26 | 27 | group = 28 | Group.OfEight.create(1, "second", 3.1f, 4.2, 5000L, 6, "seventh", 8.7f); 29 | assertThat(group.first).isEqualTo(1); 30 | assertThat(group.second).isEqualTo("second"); 31 | assertThat(group.third).isEqualTo(3.1f); 32 | assertThat(group.fourth).isEqualTo(4.2); 33 | assertThat(group.fifth).isEqualTo(5000L); 34 | assertThat(group.sixth).isEqualTo(6); 35 | assertThat(group.seventh).isEqualTo("seventh"); 36 | assertThat(group.eighth).isEqualTo(8.7f); 37 | } 38 | 39 | @Test 40 | public void testEqualsAndHashcode() throws Exception { 41 | Group.OfEight groupOne = 42 | new Group.OfEight<>(1, "second", 3.1f, 4.2, 5000L, 6, "seventh", 8.7f); 43 | Group.OfEight groupTwo = 44 | new Group.OfEight<>(1, "second", 3.1f, 4.2, 5000L, 6, "seventh", 8.7f); 45 | 46 | assertThat(groupOne.equals(groupTwo)).isTrue(); 47 | assertThat(groupOne.hashCode()).isEqualTo(groupTwo.hashCode()); 48 | 49 | //all different 50 | groupTwo.first = 2; 51 | groupTwo.second = "not_second"; 52 | groupTwo.third = 3.2f; 53 | groupTwo.fourth = 4.3; 54 | groupTwo.fifth = 5001L; 55 | groupTwo.sixth = 7; 56 | groupTwo.seventh = "not_seventh"; 57 | groupTwo.eighth = 8.8f; 58 | assertThat(groupOne.equals(groupTwo)).isFalse(); 59 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 60 | 61 | //one different 62 | groupTwo.first = 1; 63 | groupTwo.second = "not_second"; 64 | groupTwo.third = 3.1f; 65 | groupTwo.fourth = 4.2; 66 | groupTwo.fifth = 5000L; 67 | groupTwo.sixth = 6; 68 | groupTwo.seventh = "seventh"; 69 | groupTwo.eighth = 8.7f; 70 | assertThat(groupOne.equals(groupTwo)).isFalse(); 71 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 72 | 73 | groupTwo.first = 2; 74 | groupTwo.second = "second"; 75 | groupTwo.third = 3.1f; 76 | groupTwo.fourth = 4.2; 77 | groupTwo.fifth = 5000L; 78 | groupTwo.sixth = 6; 79 | groupTwo.seventh = "seventh"; 80 | groupTwo.eighth = 8.7f; 81 | assertThat(groupOne.equals(groupTwo)).isFalse(); 82 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 83 | 84 | groupTwo.first = 1; 85 | groupTwo.second = "second"; 86 | groupTwo.third = 3.2f; 87 | groupTwo.fourth = 4.2; 88 | groupTwo.fifth = 5000L; 89 | groupTwo.sixth = 6; 90 | groupTwo.seventh = "seventh"; 91 | groupTwo.eighth = 8.7f; 92 | assertThat(groupOne.equals(groupTwo)).isFalse(); 93 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 94 | 95 | groupTwo.first = 1; 96 | groupTwo.second = "second"; 97 | groupTwo.third = 3.1f; 98 | groupTwo.fourth = 4.3; 99 | groupTwo.fifth = 5000L; 100 | groupTwo.sixth = 6; 101 | groupTwo.seventh = "seventh"; 102 | groupTwo.eighth = 8.7f; 103 | assertThat(groupOne.equals(groupTwo)).isFalse(); 104 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 105 | 106 | groupTwo.first = 1; 107 | groupTwo.second = "second"; 108 | groupTwo.third = 3.1f; 109 | groupTwo.fourth = 4.2; 110 | groupTwo.fifth = 5001L; 111 | groupTwo.sixth = 6; 112 | groupTwo.seventh = "seventh"; 113 | groupTwo.eighth = 8.7f; 114 | assertThat(groupOne.equals(groupTwo)).isFalse(); 115 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 116 | 117 | groupTwo.first = 1; 118 | groupTwo.second = "second"; 119 | groupTwo.third = 3.1f; 120 | groupTwo.fourth = 4.2; 121 | groupTwo.fifth = 5000L; 122 | groupTwo.sixth = 7; 123 | groupTwo.seventh = "seventh"; 124 | groupTwo.eighth = 8.7f; 125 | assertThat(groupOne.equals(groupTwo)).isFalse(); 126 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 127 | 128 | groupTwo.first = 1; 129 | groupTwo.second = "second"; 130 | groupTwo.third = 3.1f; 131 | groupTwo.fourth = 4.2; 132 | groupTwo.fifth = 5000L; 133 | groupTwo.sixth = 6; 134 | groupTwo.seventh = "not_seventh"; 135 | groupTwo.eighth = 8.7f; 136 | assertThat(groupOne.equals(groupTwo)).isFalse(); 137 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 138 | 139 | groupTwo.first = 1; 140 | groupTwo.second = "second"; 141 | groupTwo.third = 3.1f; 142 | groupTwo.fourth = 4.2; 143 | groupTwo.fifth = 5000L; 144 | groupTwo.sixth = 6; 145 | groupTwo.seventh = "seventh"; 146 | groupTwo.eighth = 8.8f; 147 | assertThat(groupOne.equals(groupTwo)).isFalse(); 148 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 149 | } 150 | } -------------------------------------------------------------------------------- /groupofx/src/test/java/com/bartoszlipinski/groupofx/GroupOfNineTest.java: -------------------------------------------------------------------------------- 1 | package com.bartoszlipinski.groupofx; 2 | 3 | import org.junit.Test; 4 | 5 | import static com.google.common.truth.Truth.assertThat; 6 | 7 | /** 8 | * Created by Bartosz Lipinski 9 | * 13.06.2016 10 | */ 11 | public class GroupOfNineTest { 12 | 13 | @SuppressWarnings("deprecation") 14 | @Test 15 | public void testCreate() throws Exception { 16 | Group.OfNine group = 17 | new Group.OfNine<>(1, "second", 3.1f, 4.2, 5000L, 6, "seventh", 8.7f, 9.8); 18 | assertThat(group.first).isEqualTo(1); 19 | assertThat(group.second).isEqualTo("second"); 20 | assertThat(group.third).isEqualTo(3.1f); 21 | assertThat(group.fourth).isEqualTo(4.2); 22 | assertThat(group.fifth).isEqualTo(5000L); 23 | assertThat(group.sixth).isEqualTo(6); 24 | assertThat(group.seventh).isEqualTo("seventh"); 25 | assertThat(group.eighth).isEqualTo(8.7f); 26 | assertThat(group.ninth).isEqualTo(9.8); 27 | 28 | group = 29 | Group.OfNine.create(1, "second", 3.1f, 4.2, 5000L, 6, "seventh", 8.7f, 9.8); 30 | assertThat(group.first).isEqualTo(1); 31 | assertThat(group.second).isEqualTo("second"); 32 | assertThat(group.third).isEqualTo(3.1f); 33 | assertThat(group.fourth).isEqualTo(4.2); 34 | assertThat(group.fifth).isEqualTo(5000L); 35 | assertThat(group.sixth).isEqualTo(6); 36 | assertThat(group.seventh).isEqualTo("seventh"); 37 | assertThat(group.eighth).isEqualTo(8.7f); 38 | assertThat(group.ninth).isEqualTo(9.8); 39 | } 40 | 41 | @Test 42 | public void testEqualsAndHashcode() throws Exception { 43 | Group.OfNine groupOne = 44 | new Group.OfNine<>(1, "second", 3.1f, 4.2, 5000L, 6, "seventh", 8.7f, 9.8); 45 | Group.OfNine groupTwo = 46 | new Group.OfNine<>(1, "second", 3.1f, 4.2, 5000L, 6, "seventh", 8.7f, 9.8); 47 | 48 | assertThat(groupOne.equals(groupTwo)).isTrue(); 49 | assertThat(groupOne.hashCode()).isEqualTo(groupTwo.hashCode()); 50 | 51 | //all different 52 | groupTwo.first = 2; 53 | groupTwo.second = "not_second"; 54 | groupTwo.third = 3.2f; 55 | groupTwo.fourth = 4.3; 56 | groupTwo.fifth = 5001L; 57 | groupTwo.sixth = 7; 58 | groupTwo.seventh = "not_seventh"; 59 | groupTwo.eighth = 8.8f; 60 | groupTwo.ninth = 9.9; 61 | assertThat(groupOne.equals(groupTwo)).isFalse(); 62 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 63 | 64 | //one different 65 | groupTwo.first = 1; 66 | groupTwo.second = "not_second"; 67 | groupTwo.third = 3.1f; 68 | groupTwo.fourth = 4.2; 69 | groupTwo.fifth = 5000L; 70 | groupTwo.sixth = 6; 71 | groupTwo.seventh = "seventh"; 72 | groupTwo.eighth = 8.7f; 73 | groupTwo.ninth = 9.8; 74 | assertThat(groupOne.equals(groupTwo)).isFalse(); 75 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 76 | 77 | groupTwo.first = 2; 78 | groupTwo.second = "second"; 79 | groupTwo.third = 3.1f; 80 | groupTwo.fourth = 4.2; 81 | groupTwo.fifth = 5000L; 82 | groupTwo.sixth = 6; 83 | groupTwo.seventh = "seventh"; 84 | groupTwo.eighth = 8.7f; 85 | groupTwo.ninth = 9.8; 86 | assertThat(groupOne.equals(groupTwo)).isFalse(); 87 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 88 | 89 | groupTwo.first = 1; 90 | groupTwo.second = "second"; 91 | groupTwo.third = 3.2f; 92 | groupTwo.fourth = 4.2; 93 | groupTwo.fifth = 5000L; 94 | groupTwo.sixth = 6; 95 | groupTwo.seventh = "seventh"; 96 | groupTwo.eighth = 8.7f; 97 | groupTwo.ninth = 9.8; 98 | assertThat(groupOne.equals(groupTwo)).isFalse(); 99 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 100 | 101 | groupTwo.first = 1; 102 | groupTwo.second = "second"; 103 | groupTwo.third = 3.1f; 104 | groupTwo.fourth = 4.3; 105 | groupTwo.fifth = 5000L; 106 | groupTwo.sixth = 6; 107 | groupTwo.seventh = "seventh"; 108 | groupTwo.eighth = 8.7f; 109 | groupTwo.ninth = 9.8; 110 | assertThat(groupOne.equals(groupTwo)).isFalse(); 111 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 112 | 113 | groupTwo.first = 1; 114 | groupTwo.second = "second"; 115 | groupTwo.third = 3.1f; 116 | groupTwo.fourth = 4.2; 117 | groupTwo.fifth = 5001L; 118 | groupTwo.sixth = 6; 119 | groupTwo.seventh = "seventh"; 120 | groupTwo.eighth = 8.7f; 121 | groupTwo.ninth = 9.8; 122 | assertThat(groupOne.equals(groupTwo)).isFalse(); 123 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 124 | 125 | groupTwo.first = 1; 126 | groupTwo.second = "second"; 127 | groupTwo.third = 3.1f; 128 | groupTwo.fourth = 4.2; 129 | groupTwo.fifth = 5000L; 130 | groupTwo.sixth = 7; 131 | groupTwo.seventh = "seventh"; 132 | groupTwo.eighth = 8.7f; 133 | groupTwo.ninth = 9.8; 134 | assertThat(groupOne.equals(groupTwo)).isFalse(); 135 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 136 | 137 | groupTwo.first = 1; 138 | groupTwo.second = "second"; 139 | groupTwo.third = 3.1f; 140 | groupTwo.fourth = 4.2; 141 | groupTwo.fifth = 5000L; 142 | groupTwo.sixth = 6; 143 | groupTwo.seventh = "not_seventh"; 144 | groupTwo.eighth = 8.7f; 145 | groupTwo.ninth = 9.8; 146 | assertThat(groupOne.equals(groupTwo)).isFalse(); 147 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 148 | 149 | groupTwo.first = 1; 150 | groupTwo.second = "second"; 151 | groupTwo.third = 3.1f; 152 | groupTwo.fourth = 4.2; 153 | groupTwo.fifth = 5000L; 154 | groupTwo.sixth = 6; 155 | groupTwo.seventh = "seventh"; 156 | groupTwo.eighth = 8.8f; 157 | groupTwo.ninth = 9.8; 158 | assertThat(groupOne.equals(groupTwo)).isFalse(); 159 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 160 | 161 | groupTwo.first = 1; 162 | groupTwo.second = "second"; 163 | groupTwo.third = 3.1f; 164 | groupTwo.fourth = 4.2; 165 | groupTwo.fifth = 5000L; 166 | groupTwo.sixth = 6; 167 | groupTwo.seventh = "seventh"; 168 | groupTwo.eighth = 8.7f; 169 | groupTwo.ninth = 9.9; 170 | assertThat(groupOne.equals(groupTwo)).isFalse(); 171 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 172 | } 173 | 174 | } -------------------------------------------------------------------------------- /groupofx/src/test/java/com/bartoszlipinski/groupofx/GroupOfTenTest.java: -------------------------------------------------------------------------------- 1 | package com.bartoszlipinski.groupofx; 2 | 3 | import org.junit.Test; 4 | 5 | import static com.google.common.truth.Truth.assertThat; 6 | 7 | /** 8 | * Created by Bartosz Lipinski 9 | * 13.06.2016 10 | */ 11 | public class GroupOfTenTest { 12 | 13 | @SuppressWarnings("deprecation") 14 | @Test 15 | public void testCreate() throws Exception { 16 | Group.OfTen group = 17 | new Group.OfTen<>(1, "second", 3.1f, 4.2, 5000L, 6, "seventh", 8.7f, 9.8, 10000L); 18 | assertThat(group.first).isEqualTo(1); 19 | assertThat(group.second).isEqualTo("second"); 20 | assertThat(group.third).isEqualTo(3.1f); 21 | assertThat(group.fourth).isEqualTo(4.2); 22 | assertThat(group.fifth).isEqualTo(5000L); 23 | assertThat(group.sixth).isEqualTo(6); 24 | assertThat(group.seventh).isEqualTo("seventh"); 25 | assertThat(group.eighth).isEqualTo(8.7f); 26 | assertThat(group.ninth).isEqualTo(9.8); 27 | assertThat(group.tenth).isEqualTo(10000L); 28 | 29 | group = 30 | Group.OfTen.create(1, "second", 3.1f, 4.2, 5000L, 6, "seventh", 8.7f, 9.8, 10000L); 31 | assertThat(group.first).isEqualTo(1); 32 | assertThat(group.second).isEqualTo("second"); 33 | assertThat(group.third).isEqualTo(3.1f); 34 | assertThat(group.fourth).isEqualTo(4.2); 35 | assertThat(group.fifth).isEqualTo(5000L); 36 | assertThat(group.sixth).isEqualTo(6); 37 | assertThat(group.seventh).isEqualTo("seventh"); 38 | assertThat(group.eighth).isEqualTo(8.7f); 39 | assertThat(group.ninth).isEqualTo(9.8); 40 | assertThat(group.tenth).isEqualTo(10000L); 41 | } 42 | 43 | @Test 44 | public void testEqualsAndHashcode() throws Exception { 45 | Group.OfTen groupOne = 46 | new Group.OfTen<>(1, "second", 3.1f, 4.2, 5000L, 6, "seventh", 8.7f, 9.8, 10000L); 47 | Group.OfTen groupTwo = 48 | new Group.OfTen<>(1, "second", 3.1f, 4.2, 5000L, 6, "seventh", 8.7f, 9.8, 10000L); 49 | 50 | assertThat(groupOne.equals(groupTwo)).isTrue(); 51 | assertThat(groupOne.hashCode()).isEqualTo(groupTwo.hashCode()); 52 | 53 | //all different 54 | groupTwo.first = 2; 55 | groupTwo.second = "not_second"; 56 | groupTwo.third = 3.2f; 57 | groupTwo.fourth = 4.3; 58 | groupTwo.fifth = 5001L; 59 | groupTwo.sixth = 7; 60 | groupTwo.seventh = "not_seventh"; 61 | groupTwo.eighth = 8.8f; 62 | groupTwo.ninth = 9.9; 63 | groupTwo.tenth = 10001L; 64 | assertThat(groupOne.equals(groupTwo)).isFalse(); 65 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 66 | 67 | //one different 68 | groupTwo.first = 1; 69 | groupTwo.second = "not_second"; 70 | groupTwo.third = 3.1f; 71 | groupTwo.fourth = 4.2; 72 | groupTwo.fifth = 5000L; 73 | groupTwo.sixth = 6; 74 | groupTwo.seventh = "seventh"; 75 | groupTwo.eighth = 8.7f; 76 | groupTwo.ninth = 9.8; 77 | groupTwo.tenth = 10000L; 78 | assertThat(groupOne.equals(groupTwo)).isFalse(); 79 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 80 | 81 | groupTwo.first = 2; 82 | groupTwo.second = "second"; 83 | groupTwo.third = 3.1f; 84 | groupTwo.fourth = 4.2; 85 | groupTwo.fifth = 5000L; 86 | groupTwo.sixth = 6; 87 | groupTwo.seventh = "seventh"; 88 | groupTwo.eighth = 8.7f; 89 | groupTwo.ninth = 9.8; 90 | groupTwo.tenth = 10000L; 91 | assertThat(groupOne.equals(groupTwo)).isFalse(); 92 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 93 | 94 | groupTwo.first = 1; 95 | groupTwo.second = "second"; 96 | groupTwo.third = 3.2f; 97 | groupTwo.fourth = 4.2; 98 | groupTwo.fifth = 5000L; 99 | groupTwo.sixth = 6; 100 | groupTwo.seventh = "seventh"; 101 | groupTwo.eighth = 8.7f; 102 | groupTwo.ninth = 9.8; 103 | groupTwo.tenth = 10000L; 104 | assertThat(groupOne.equals(groupTwo)).isFalse(); 105 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 106 | 107 | groupTwo.first = 1; 108 | groupTwo.second = "second"; 109 | groupTwo.third = 3.1f; 110 | groupTwo.fourth = 4.3; 111 | groupTwo.fifth = 5000L; 112 | groupTwo.sixth = 6; 113 | groupTwo.seventh = "seventh"; 114 | groupTwo.eighth = 8.7f; 115 | groupTwo.ninth = 9.8; 116 | groupTwo.tenth = 10000L; 117 | assertThat(groupOne.equals(groupTwo)).isFalse(); 118 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 119 | 120 | groupTwo.first = 1; 121 | groupTwo.second = "second"; 122 | groupTwo.third = 3.1f; 123 | groupTwo.fourth = 4.2; 124 | groupTwo.fifth = 5001L; 125 | groupTwo.sixth = 6; 126 | groupTwo.seventh = "seventh"; 127 | groupTwo.eighth = 8.7f; 128 | groupTwo.ninth = 9.8; 129 | groupTwo.tenth = 10000L; 130 | assertThat(groupOne.equals(groupTwo)).isFalse(); 131 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 132 | 133 | groupTwo.first = 1; 134 | groupTwo.second = "second"; 135 | groupTwo.third = 3.1f; 136 | groupTwo.fourth = 4.2; 137 | groupTwo.fifth = 5000L; 138 | groupTwo.sixth = 7; 139 | groupTwo.seventh = "seventh"; 140 | groupTwo.eighth = 8.7f; 141 | groupTwo.ninth = 9.8; 142 | groupTwo.tenth = 10000L; 143 | assertThat(groupOne.equals(groupTwo)).isFalse(); 144 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 145 | 146 | groupTwo.first = 1; 147 | groupTwo.second = "second"; 148 | groupTwo.third = 3.1f; 149 | groupTwo.fourth = 4.2; 150 | groupTwo.fifth = 5000L; 151 | groupTwo.sixth = 6; 152 | groupTwo.seventh = "not_seventh"; 153 | groupTwo.eighth = 8.7f; 154 | groupTwo.ninth = 9.8; 155 | groupTwo.tenth = 10000L; 156 | assertThat(groupOne.equals(groupTwo)).isFalse(); 157 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 158 | 159 | groupTwo.first = 1; 160 | groupTwo.second = "second"; 161 | groupTwo.third = 3.1f; 162 | groupTwo.fourth = 4.2; 163 | groupTwo.fifth = 5000L; 164 | groupTwo.sixth = 6; 165 | groupTwo.seventh = "seventh"; 166 | groupTwo.eighth = 8.8f; 167 | groupTwo.ninth = 9.8; 168 | groupTwo.tenth = 10000L; 169 | assertThat(groupOne.equals(groupTwo)).isFalse(); 170 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 171 | 172 | groupTwo.first = 1; 173 | groupTwo.second = "second"; 174 | groupTwo.third = 3.1f; 175 | groupTwo.fourth = 4.2; 176 | groupTwo.fifth = 5000L; 177 | groupTwo.sixth = 6; 178 | groupTwo.seventh = "seventh"; 179 | groupTwo.eighth = 8.7f; 180 | groupTwo.ninth = 9.9; 181 | groupTwo.tenth = 10000L; 182 | assertThat(groupOne.equals(groupTwo)).isFalse(); 183 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 184 | 185 | groupTwo.first = 1; 186 | groupTwo.second = "second"; 187 | groupTwo.third = 3.1f; 188 | groupTwo.fourth = 4.2; 189 | groupTwo.fifth = 5000L; 190 | groupTwo.sixth = 6; 191 | groupTwo.seventh = "seventh"; 192 | groupTwo.eighth = 8.7f; 193 | groupTwo.ninth = 9.8; 194 | groupTwo.tenth = 10001L; 195 | assertThat(groupOne.equals(groupTwo)).isFalse(); 196 | assertThat(groupOne.hashCode()).isNotEqualTo(groupTwo.hashCode()); 197 | } 198 | 199 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /groupofx/src/main/java/com/bartoszlipinski/groupofx/Group.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Bartosz Lipinski 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.bartoszlipinski.groupofx; 17 | 18 | /** 19 | * They do not extend each other on purpose. 20 | */ 21 | public final class Group { 22 | 23 | // Suppress default constructor for noninstantiability 24 | private Group() { 25 | throw new AssertionError(); 26 | } 27 | 28 | public static final class OfTwo { 29 | public First first; 30 | public Second second; 31 | 32 | public OfTwo(First first, Second second) { 33 | this.first = first; 34 | this.second = second; 35 | } 36 | 37 | @Override 38 | public final boolean equals(Object o) { 39 | if (!(o instanceof OfTwo)) { 40 | return false; 41 | } 42 | OfTwo p = (OfTwo) o; 43 | return Objects.equal(p.first, first) && Objects.equal(p.second, second); 44 | } 45 | 46 | @Override 47 | public final int hashCode() { 48 | return (first == null ? 0 : first.hashCode()) ^ (second == null ? 0 : second.hashCode()); 49 | } 50 | 51 | public static OfTwo create(First first, Second second) { 52 | return new OfTwo<>(first, second); 53 | } 54 | } 55 | 56 | public static final class OfThree { 57 | public First first; 58 | public Second second; 59 | public Third third; 60 | 61 | public OfThree(First first, Second second, Third third) { 62 | this.first = first; 63 | this.second = second; 64 | this.third = third; 65 | } 66 | 67 | @Override 68 | public final boolean equals(Object o) { 69 | if (!(o instanceof OfThree)) { 70 | return false; 71 | } 72 | OfThree p = (OfThree) o; 73 | return Objects.equal(p.first, first) && 74 | Objects.equal(p.second, second) && 75 | Objects.equal(p.third, third); 76 | } 77 | 78 | @Override 79 | public final int hashCode() { 80 | return (first == null ? 0 : first.hashCode()) ^ 81 | (second == null ? 0 : second.hashCode()) ^ 82 | (third == null ? 0 : third.hashCode()); 83 | } 84 | 85 | public static OfThree create( 86 | First first, Second second, Third third) { 87 | return new OfThree<>(first, second, third); 88 | } 89 | } 90 | 91 | public static final class OfFour { 92 | public First first; 93 | public Second second; 94 | public Third third; 95 | public Fourth fourth; 96 | 97 | public OfFour(First first, Second second, Third third, Fourth fourth) { 98 | this.first = first; 99 | this.second = second; 100 | this.third = third; 101 | this.fourth = fourth; 102 | } 103 | 104 | @Override 105 | public final boolean equals(Object o) { 106 | if (!(o instanceof OfFour)) { 107 | return false; 108 | } 109 | OfFour p = (OfFour) o; 110 | return Objects.equal(p.first, first) && 111 | Objects.equal(p.second, second) && 112 | Objects.equal(p.third, third) && 113 | Objects.equal(p.fourth, fourth); 114 | } 115 | 116 | @Override 117 | public final int hashCode() { 118 | return (first == null ? 0 : first.hashCode()) ^ 119 | (second == null ? 0 : second.hashCode()) ^ 120 | (third == null ? 0 : third.hashCode()) ^ 121 | (fourth == null ? 0 : fourth.hashCode()); 122 | } 123 | 124 | public static OfFour create( 125 | First first, Second second, Third third, Fourth fourth) { 126 | return new OfFour<>(first, second, third, fourth); 127 | } 128 | } 129 | 130 | public final static class OfFive { 131 | public First first; 132 | public Second second; 133 | public Third third; 134 | public Fourth fourth; 135 | public Fifth fifth; 136 | 137 | public OfFive(First first, Second second, Third third, Fourth fourth, Fifth fifth) { 138 | this.first = first; 139 | this.second = second; 140 | this.third = third; 141 | this.fourth = fourth; 142 | this.fifth = fifth; 143 | } 144 | 145 | @Override 146 | public final boolean equals(Object o) { 147 | if (!(o instanceof OfFive)) { 148 | return false; 149 | } 150 | OfFive p = (OfFive) o; 151 | return Objects.equal(p.first, first) && 152 | Objects.equal(p.second, second) && 153 | Objects.equal(p.third, third) && 154 | Objects.equal(p.fourth, fourth) && 155 | Objects.equal(p.fifth, fifth); 156 | } 157 | 158 | @Override 159 | public final int hashCode() { 160 | return (first == null ? 0 : first.hashCode()) ^ 161 | (second == null ? 0 : second.hashCode()) ^ 162 | (third == null ? 0 : third.hashCode()) ^ 163 | (fourth == null ? 0 : fourth.hashCode()) ^ 164 | (fifth == null ? 0 : fifth.hashCode()); 165 | } 166 | 167 | 168 | public static OfFive create( 169 | First first, Second second, Third third, Fourth fourth, Fifth fifth) { 170 | return new OfFive<>(first, second, third, fourth, fifth); 171 | } 172 | } 173 | 174 | public final static class OfSix { 175 | public First first; 176 | public Second second; 177 | public Third third; 178 | public Fourth fourth; 179 | public Fifth fifth; 180 | public Sixth sixth; 181 | 182 | public OfSix(First first, Second second, Third third, Fourth fourth, Fifth fifth, Sixth sixth) { 183 | this.first = first; 184 | this.second = second; 185 | this.third = third; 186 | this.fourth = fourth; 187 | this.fifth = fifth; 188 | this.sixth = sixth; 189 | } 190 | 191 | @Override 192 | public final boolean equals(Object o) { 193 | if (!(o instanceof OfSix)) { 194 | return false; 195 | } 196 | OfSix p = (OfSix) o; 197 | return Objects.equal(p.first, first) && 198 | Objects.equal(p.second, second) && 199 | Objects.equal(p.third, third) && 200 | Objects.equal(p.fourth, fourth) && 201 | Objects.equal(p.fifth, fifth) && 202 | Objects.equal(p.sixth, sixth); 203 | } 204 | 205 | @Override 206 | public final int hashCode() { 207 | return (first == null ? 0 : first.hashCode()) ^ 208 | (second == null ? 0 : second.hashCode()) ^ 209 | (third == null ? 0 : third.hashCode()) ^ 210 | (fourth == null ? 0 : fourth.hashCode()) ^ 211 | (fifth == null ? 0 : fifth.hashCode()) ^ 212 | (sixth == null ? 0 : sixth.hashCode()); 213 | } 214 | 215 | public static OfSix create( 216 | First first, Second second, Third third, Fourth fourth, Fifth fifth, Sixth sixth) { 217 | return new OfSix<>(first, second, third, fourth, fifth, sixth); 218 | } 219 | } 220 | 221 | public final static class OfSeven { 222 | public First first; 223 | public Second second; 224 | public Third third; 225 | public Fourth fourth; 226 | public Fifth fifth; 227 | public Sixth sixth; 228 | public Seventh seventh; 229 | 230 | public OfSeven(First first, Second second, Third third, Fourth fourth, Fifth fifth, 231 | Sixth sixth, Seventh seventh) { 232 | this.first = first; 233 | this.second = second; 234 | this.third = third; 235 | this.fourth = fourth; 236 | this.fifth = fifth; 237 | this.sixth = sixth; 238 | this.seventh = seventh; 239 | } 240 | 241 | @Override 242 | public final boolean equals(Object o) { 243 | if (!(o instanceof OfSeven)) { 244 | return false; 245 | } 246 | OfSeven p = (OfSeven) o; 247 | return Objects.equal(p.first, first) && 248 | Objects.equal(p.second, second) && 249 | Objects.equal(p.third, third) && 250 | Objects.equal(p.fourth, fourth) && 251 | Objects.equal(p.fifth, fifth) && 252 | Objects.equal(p.sixth, sixth) && 253 | Objects.equal(p.seventh, seventh); 254 | } 255 | 256 | @Override 257 | public final int hashCode() { 258 | return (first == null ? 0 : first.hashCode()) ^ 259 | (second == null ? 0 : second.hashCode()) ^ 260 | (third == null ? 0 : third.hashCode()) ^ 261 | (fourth == null ? 0 : fourth.hashCode()) ^ 262 | (fifth == null ? 0 : fifth.hashCode()) ^ 263 | (sixth == null ? 0 : sixth.hashCode()) ^ 264 | (seventh == null ? 0 : seventh.hashCode()); 265 | } 266 | 267 | public static OfSeven create( 268 | First first, Second second, Third third, Fourth fourth, Fifth fifth, 269 | Sixth sixth, Seventh seventh) { 270 | return new OfSeven<>(first, second, third, fourth, fifth, sixth, seventh); 271 | } 272 | } 273 | 274 | public final static class OfEight { 275 | public First first; 276 | public Second second; 277 | public Third third; 278 | public Fourth fourth; 279 | public Fifth fifth; 280 | public Sixth sixth; 281 | public Seventh seventh; 282 | public Eighth eighth; 283 | 284 | public OfEight(First first, Second second, Third third, Fourth fourth, Fifth fifth, 285 | Sixth sixth, Seventh seventh, Eighth eighth) { 286 | this.first = first; 287 | this.second = second; 288 | this.third = third; 289 | this.fourth = fourth; 290 | this.fifth = fifth; 291 | this.sixth = sixth; 292 | this.seventh = seventh; 293 | this.eighth = eighth; 294 | } 295 | 296 | @Override 297 | public final boolean equals(Object o) { 298 | if (!(o instanceof OfEight)) { 299 | return false; 300 | } 301 | OfEight p = (OfEight) o; 302 | return Objects.equal(p.first, first) && 303 | Objects.equal(p.second, second) && 304 | Objects.equal(p.third, third) && 305 | Objects.equal(p.fourth, fourth) && 306 | Objects.equal(p.fifth, fifth) && 307 | Objects.equal(p.sixth, sixth) && 308 | Objects.equal(p.seventh, seventh) && 309 | Objects.equal(p.eighth, eighth); 310 | } 311 | 312 | @Override 313 | public final int hashCode() { 314 | return (first == null ? 0 : first.hashCode()) ^ 315 | (second == null ? 0 : second.hashCode()) ^ 316 | (third == null ? 0 : third.hashCode()) ^ 317 | (fourth == null ? 0 : fourth.hashCode()) ^ 318 | (fifth == null ? 0 : fifth.hashCode()) ^ 319 | (sixth == null ? 0 : sixth.hashCode()) ^ 320 | (seventh == null ? 0 : seventh.hashCode()) ^ 321 | (eighth == null ? 0 : eighth.hashCode()); 322 | } 323 | 324 | public static OfEight create( 325 | First first, Second second, Third third, Fourth fourth, Fifth fifth, 326 | Sixth sixth, Seventh seventh, Eighth eighth) { 327 | return new OfEight<>(first, second, third, fourth, fifth, sixth, seventh, eighth); 328 | } 329 | } 330 | 331 | public final static class OfNine { 332 | public First first; 333 | public Second second; 334 | public Third third; 335 | public Fourth fourth; 336 | public Fifth fifth; 337 | public Sixth sixth; 338 | public Seventh seventh; 339 | public Eighth eighth; 340 | public Ninth ninth; 341 | 342 | public OfNine(First first, Second second, Third third, Fourth fourth, Fifth fifth, 343 | Sixth sixth, Seventh seventh, Eighth eighth, Ninth ninth) { 344 | this.first = first; 345 | this.second = second; 346 | this.third = third; 347 | this.fourth = fourth; 348 | this.fifth = fifth; 349 | this.sixth = sixth; 350 | this.seventh = seventh; 351 | this.eighth = eighth; 352 | this.ninth = ninth; 353 | } 354 | 355 | @Override 356 | public final boolean equals(Object o) { 357 | if (!(o instanceof OfNine)) { 358 | return false; 359 | } 360 | OfNine p = (OfNine) o; 361 | return Objects.equal(p.first, first) && 362 | Objects.equal(p.second, second) && 363 | Objects.equal(p.third, third) && 364 | Objects.equal(p.fourth, fourth) && 365 | Objects.equal(p.fifth, fifth) && 366 | Objects.equal(p.sixth, sixth) && 367 | Objects.equal(p.seventh, seventh) && 368 | Objects.equal(p.eighth, eighth) && 369 | Objects.equal(p.ninth, ninth); 370 | } 371 | 372 | @Override 373 | public final int hashCode() { 374 | return (first == null ? 0 : first.hashCode()) ^ 375 | (second == null ? 0 : second.hashCode()) ^ 376 | (third == null ? 0 : third.hashCode()) ^ 377 | (fourth == null ? 0 : fourth.hashCode()) ^ 378 | (fifth == null ? 0 : fifth.hashCode()) ^ 379 | (sixth == null ? 0 : sixth.hashCode()) ^ 380 | (seventh == null ? 0 : seventh.hashCode()) ^ 381 | (eighth == null ? 0 : eighth.hashCode()) ^ 382 | (ninth == null ? 0 : ninth.hashCode()); 383 | } 384 | 385 | public static OfNine create( 386 | First first, Second second, Third third, Fourth fourth, Fifth fifth, 387 | Sixth sixth, Seventh seventh, Eighth eighth, Ninth ninth) { 388 | return new OfNine<>(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth); 389 | } 390 | } 391 | 392 | public final static class OfTen { 393 | public First first; 394 | public Second second; 395 | public Third third; 396 | public Fourth fourth; 397 | public Fifth fifth; 398 | public Sixth sixth; 399 | public Seventh seventh; 400 | public Eighth eighth; 401 | public Ninth ninth; 402 | public Tenth tenth; 403 | 404 | public OfTen(First first, Second second, Third third, Fourth fourth, Fifth fifth, 405 | Sixth sixth, Seventh seventh, Eighth eighth, Ninth ninth, Tenth tenth) { 406 | this.first = first; 407 | this.second = second; 408 | this.third = third; 409 | this.fourth = fourth; 410 | this.fifth = fifth; 411 | this.sixth = sixth; 412 | this.seventh = seventh; 413 | this.eighth = eighth; 414 | this.ninth = ninth; 415 | this.tenth = tenth; 416 | } 417 | 418 | @Override 419 | public final boolean equals(Object o) { 420 | if (!(o instanceof OfTen)) { 421 | return false; 422 | } 423 | OfTen p = (OfTen) o; 424 | return Objects.equal(p.first, first) && 425 | Objects.equal(p.second, second) && 426 | Objects.equal(p.third, third) && 427 | Objects.equal(p.fourth, fourth) && 428 | Objects.equal(p.fifth, fifth) && 429 | Objects.equal(p.sixth, sixth) && 430 | Objects.equal(p.seventh, seventh) && 431 | Objects.equal(p.eighth, eighth) && 432 | Objects.equal(p.ninth, ninth) && 433 | Objects.equal(p.tenth, tenth); 434 | } 435 | 436 | @Override 437 | public final int hashCode() { 438 | return (first == null ? 0 : first.hashCode()) ^ 439 | (second == null ? 0 : second.hashCode()) ^ 440 | (third == null ? 0 : third.hashCode()) ^ 441 | (fourth == null ? 0 : fourth.hashCode()) ^ 442 | (fifth == null ? 0 : fifth.hashCode()) ^ 443 | (sixth == null ? 0 : sixth.hashCode()) ^ 444 | (seventh == null ? 0 : seventh.hashCode()) ^ 445 | (eighth == null ? 0 : eighth.hashCode()) ^ 446 | (ninth == null ? 0 : ninth.hashCode()) ^ 447 | (tenth == null ? 0 : tenth.hashCode()); 448 | } 449 | 450 | public static OfTen create( 451 | First first, Second second, Third third, Fourth fourth, Fifth fifth, 452 | Sixth sixth, Seventh seventh, Eighth eighth, Ninth ninth, Tenth tenth) { 453 | return new OfTen<>(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth); 454 | } 455 | } 456 | 457 | private static final class Objects { 458 | public static boolean equal(Object a, Object b) { 459 | return a == b || (a != null && a.equals(b)); 460 | } 461 | } 462 | } --------------------------------------------------------------------------------