Last active
August 17, 2020 19:42
-
-
Save wispborne/5d7bde79a3967b27d9e25a74bccfdad7 to your computer and use it in GitHub Desktop.
Revisions
-
wispborne revised this gist
Mar 4, 2019 . 2 changed files with 12 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ public Person cloneWithNewName(Person original, String newName) { return new Person( original.id, newName, original.role, original.gender, original.seatingPosition, original.title ) } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ fun cloneWithNewName(orignal: Person, newName: String): Person = original.copy(name = newName) -
wispborne revised this gist
Mar 23, 2018 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ /** Example of a {@link Class} declaration */ public final class MyClass { private boolean someBool; public MyClass() { @@ -13,7 +13,7 @@ public boolean getSomeBool() { return someBool; } public void setSomeBool(@NonNull boolean value) { someBool = value; } -
wispborne revised this gist
Sep 2, 2016 . 2 changed files with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes.File renamed without changes. -
wispborne revised this gist
Jun 1, 2016 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,9 @@ final class MyClass { private boolean someBool; public MyClass() { } public MyClass(boolean someBool) { this.someBool = someBool; } -
wispborne revised this gist
May 22, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,5 +3,5 @@ fun printRxJavaStuff() { Observable.from(asList("one fish", "two fish", "red fish", "blue fish")) .filter { it.contains("one") || it.contains("two") } .map { it.replace("fish", "dish") } .subscribe( { Timber.v(s) } ) } -
wispborne revised this gist
May 20, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,2 @@ Comparison of Java 7 to Kotlin for various simple code snippets. Files with the same name do the same thing. -
wispborne revised this gist
May 20, 2016 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,7 +19,7 @@ public String toString() { return "someBool:" + someBool; } // not shown: .copy override // not shown: .hashcode override // not shown: .equals override } -
wispborne revised this gist
May 20, 2016 . 4 changed files with 31 additions and 25 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ /** Returns a subset of {@code list} containing only the items where {@code someBool == true} */ public final List<MyClass> filterList(List<MyClass> list) { List<MyClass> ret = new List<>(list.size()); for(MyClass item : list) { This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ /** Gets the second character in a string or, if not possible, returns some default value (which may be {@code null}) */ @Nullable public final String getSecondCharOrDefault(@NonNull String str, @Nullable String defaultVal) { return str.length() > 2 ? str.get(1) : defaultVal; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,19 +1,22 @@ /** First prints "one dish", then "two dish" */ public final void printRxJavaStuff() { Observable.from(Arrays.asList("one fish", "two fish", "red fish", "blue fish")) .filter(new Func1<String, Boolean>() { @Override public Boolean call(String s) { return s.contains("one") || s.contains("two"); } }) .map(new Func1<String, String>() { @Override public String call(String s) { return s.replace("fish", "dish"); } }) .subscribe(new Action1<String>() { @Override public void call(String s) { Timber.v(s); } }); } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,7 @@ /** First prints "one dish", then "two dish" */ fun printRxJavaStuff() { Observable.from(asList("one fish", "two fish", "red fish", "blue fish")) .filter { it.contains("one") || it.contains("two") } .map { it.replace("fish", "dish") } .subscribe( { Timber.v(s) } ) // First prints "one dish", then "two dish" } -
wispborne revised this gist
May 20, 2016 . 2 changed files with 23 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ Observable.from(Arrays.asList("one fish", "two fish", "red fish", "blue fish")) .filter(new Func1<String, Boolean>() { @Override public Boolean call(String s) { return s.contains("one") || s.contains("two"); } }) .map(new Func1<String, String>() { @Override public String call(String s) { return s.replace("fish", "dish"); } }) .subscribe(new Action1<String>() { @Override public void call(String s) { Timber.v(s); // First prints "one dish", then "two dish" } }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ Observable.from(asList("one fish", "two fish", "red fish", "blue fish")) .filter { it.contains("one") || it.contains("two") } .map { it.replace("fish", "dish") } .subscribe( { Timber.v(s) } ) // First prints "one dish", then "two dish" -
wispborne revised this gist
May 17, 2016 . 2 changed files with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ /** Gets the second character in a string or, if not possible, returns some default value (which may be {@code null}) */ @Nullable public String getSecondCharOrDefault(@NonNull String str, @Nullable String defaultVal) { return str.length() > 2 ? str.get(1) : defaultVal; This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1,2 @@ /** Gets the second character in a string or, if not possible, returns some default value (which may be `null`) */ fun getSecondCharOrDefault(str: String, defaultVal: String?) = if(str.length > 2) str[1] else defaultVal -
wispborne revised this gist
May 17, 2016 . 2 changed files with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ @Nullable public String getSecondCharOrDefault(@NonNull String str, @Nullable String defaultVal) { return str.length() > 2 ? str.get(1) : defaultVal; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ fun getSecondCharOrDefault(str: String, defaultVal: String?) = if(str.length > 2) str[1] else defaultVal -
wispborne revised this gist
May 17, 2016 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,2 @@ Comparison of Java to Kotlin for various simple code snippets. Files with the same name do the same thing. -
wispborne revised this gist
May 17, 2016 . 5 changed files with 8 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,9 +9,4 @@ public List<MyClass> filterList(List<MyClass> list) { } return ret; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ /** Returns a subset of `list` containing only the items where `someBool == true` */ fun filterList(items:List<MyClass>) = items.filter { item -> item.someBool } // or { it.someBool } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ /** Returns {@code "yes"} if {@code value == true} or {@code "no"} if {@code value == false}. */ public boolean yesOrNo(boolean value) { return value ? "yes" : "no"; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ /** Returns `"yes"` if `value == true` or `"no"` if `value == false`. */ fun yesOrNo(value: Boolean) = if(value) "yes" else "no" -
wispborne revised this gist
May 17, 2016 . 4 changed files with 27 additions and 29 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ /** Example of a {@link Class} declaration */ final class MyClass { private boolean someBool; public MyClass(boolean someBool) { this.someBool = someBool; } public boolean getSomeBool() { return someBool; } protected void setSomeBool(@NonNull boolean value) { someBool = value; } @Override public String toString() { return "someBool:" + someBool; } // .copy override // .hashcode override // .equals override } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ /** Example of a [Class] declaration. */ data class MyClass(var someBool: Boolean = false) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,29 +1,3 @@ /** Returns a subset of {@code list} containing only the items where {@code someBool == true} */ public List<MyClass> filterList(List<MyClass> list) { List<MyClass> ret = new List<>(list.size()); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,3 @@ /** Returns a subset of `list` containing only the items where `someBool == true` */ fun filterList(items:List<MyClass>) = items.filter { item -> item.someBool } // or { it.someBool } -
wispborne revised this gist
May 17, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -37,7 +37,7 @@ public List<MyClass> filterList(List<MyClass> list) { return ret; } /** Returns {@code "yes"} if {@code value == true} or {@code "no"} if {@code value == false}. */ public boolean yesOrNo(boolean value) { return value ? "yes" : "no"; } -
wispborne revised this gist
May 17, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,5 +4,5 @@ data class MyClass(var someBool: Boolean = false) /** Returns a subset of `list` containing only the items where `someBool == true` */ fun filterList(items:List<MyClass>) = items.filter { item -> item.someBool } // or { it.someBool } /** Returns `"yes"` if `value == true` or `"no"` if `value == false`. */ fun yesOrNo(value: Boolean) = if(value) "yes" else "no" -
wispborne revised this gist
May 17, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ /** Example of a [Class] declaration. */ data class MyClass(var someBool: Boolean = false) /** Returns a subset of `list` containing only the items where `someBool == true` */ -
wispborne revised this gist
May 17, 2016 . 2 changed files with 11 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ /** Example of a {@link Class} declaration */ final class MyClass { private boolean someBool; @@ -34,4 +35,9 @@ public List<MyClass> filterList(List<MyClass> list) { } return ret; } /** Returns {@code "yes"} if {@code value == true} or {@code "no"} if {@code value == false}. public boolean yesOrNo(boolean value) { return value ? "yes" : "no"; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,8 @@ /** Example of a [Class] declaration. data class MyClass(var someBool: Boolean = false) /** Returns a subset of `list` containing only the items where `someBool == true` */ fun filterList(items:List<MyClass>) = items.filter { item -> item.someBool } // or { it.someBool } /** Returns `"yes"` if `value == true` or `"no"` if `value == false`. fun yesOrNo(value: Boolean) = if(value) "yes" else "no" -
wispborne revised this gist
May 16, 2016 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ final class MyClass { private boolean someBool; public MyClass(boolean someBool) { @@ -16,6 +16,11 @@ class MyClass { @Override public String toString() { return "someBool:" + someBool; } // .copy override // .hashcode override // .equals override } /** Returns a subset of {@code list} containing only the items where {@code someBool == true} */ -
wispborne revised this gist
May 16, 2016 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1,2 @@ Comparison of Java to Kotlin for various simple methods. Both files do exactly the same thing. -
wispborne revised this gist
May 16, 2016 . 2 changed files with 22 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,23 @@ class MyClass { private boolean someBool; public MyClass(boolean someBool) { this.someBool = someBool; } public boolean getSomeBool() { return someBool; } protected void setSomeBool(@NonNull boolean value) { someBool = value; } @Override public String toString() { return "someBool:" + someBool; } /** Returns a subset of {@code list} containing only the items where {@code someBool == true} */ public List<MyClass> filterList(List<MyClass> list) { List<MyClass> ret = new List<>(list.size()); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,4 @@ data class MyClass(var someBool: Boolean = false) /** Returns a subset of `list` containing only the items where `someBool == true` */ fun filterList(items:List<MyClass>) = items.filter { item -> item.someBool } // or { it.someBool } -
wispborne revised this gist
May 16, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,2 @@ /** Returns a subset of `list` containing only the items where `someBool == true` */ fun filterList(items:List<MyClass>) = items.filter { item -> item.someBool } // or { it.someBool } -
wispborne revised this gist
May 16, 2016 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,12 @@ /** Returns a subset of {@code list} containing only the items where {@code someBool == true} */ public List<MyClass> filterList(List<MyClass> list) { List<MyClass> ret = new List<>(list.size()); for(MyClass item : list) { if(item.someBool) { ret.add(item); } } return ret; } -
wispborne renamed this gist
May 16, 2016 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
wispborne revised this gist
May 16, 2016 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ Comparison of Java to Kotlin for various simple methods. -
wispborne revised this gist
May 16, 2016 . No changes.There are no files selected for viewing
-
wispborne revised this gist
May 16, 2016 . 2 changed files with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ /** Returns a subset of {@code list} containing only the items where {@code someBool == true} */ public List<MyClass> filterList(List<MyClass> list) { List<MyClass> ret = new List<>(list.size()); for(MyClass item : list) { This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1,2 @@ /** Returns a subset of `list` containing only the items where `someBool == true` */ fun filterList(items:List<MyClass>) = items.filter { it.someBool } -
wispborne created this gist
May 16, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ public List<MyClass> filterList(List<MyClass> list) { List<MyClass> ret = new List<>(list.size()); for(MyClass item : list) { if(item.someBool) { ret.add(item); } } return ret; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ fun filterList(items:List<MyClass>) = items.filter { it.someBool }