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 characters
[user] | |
name = <USER> | |
email = <EMAIL> | |
signingkey = <PATH_TO_PUBLIC_KEY> | |
[gpg] | |
format = ssh | |
[commit] | |
gpgsign = true | |
[tag] | |
gpgsign = true |
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 characters
allTrue :: [Bool] -> Bool | |
allTrue [] = True | |
allTrue (head:tail) = head && allTrue tail | |
anyTrue :: [Bool] -> Bool | |
anyTrue [] = False | |
anyTrue (head:tail) = head || anyTrue tail | |
noneTrue :: [Bool] -> Bool | |
noneTrue = not . anyTrue |
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 characters
add :: Int -> Int -> Int | |
add x y = x + y | |
add3 :: Int -> Int | |
add3 = add 3 | |
main = print (add3 4) -- 7 |
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 characters
public static void main(String[] args) { | |
ZonedDateTime auckland = ZonedDateTime.of(LocalDateTime.of(2019, Month.AUGUST, 12, 20, 45), ZoneId.of("Pacific/Auckland")); | |
ZonedDateTime london = ZonedDateTime.of(LocalDateTime.of(2019, Month.AUGUST, 12, 9, 45), ZoneId.of("Europe/London")); | |
System.out.println(auckland.equals(london)); // false | |
System.out.println(auckland.isEqual(london)); // true | |
auckland = ZonedDateTime.of(LocalDateTime.of(2019, Month.DECEMBER, 12, 20, 45), ZoneId.of("Pacific/Auckland")); | |
london = ZonedDateTime.of(LocalDateTime.of(2019, Month.DECEMBER, 12, 7, 45), ZoneId.of("Europe/London")); | |
System.out.println(auckland.equals(london)); // false | |
System.out.println(auckland.isEqual(london)); // true |
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 characters
import java.util.AbstractMap; | |
import java.util.AbstractSet; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.Objects; | |
import java.util.Set; | |
public class ZippedListMap<K, V> extends AbstractMap<K, V> implements Map<K, V> { |
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 characters
import com.google.common.collect.ImmutableSetMultimap; | |
import com.google.common.collect.Multimap; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.function.Function; | |
import java.util.stream.Collectors; | |
class GroupingByAlternative { |
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 characters
import java.util.Optional; | |
class ChainingOptional { | |
static Optional<Integer> get1() { | |
return Optional.empty(); | |
} | |
static Optional<Integer> get2() { | |
return Optional.empty(); |
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 characters
import java.util.Optional; | |
import java.util.function.Supplier; | |
import java.util.stream.Stream; | |
/** | |
* Example 3. Sealed | |
* | |
* <p>Now sealed. Outsiders cannot implement the root abstraction. | |
* | |
* <p>(i.e. {@code extends Sealed} is forbidden). |