Skip to content

A very non-serious utilities to be used as static imports in very non-serious projects

License

Notifications You must be signed in to change notification settings

klepto/lazy-voids

Repository files navigation

lazy-voids

Maven Central Gradle CI License: Unlicense

Various utilities to be used as static imports in pseudocode and other non-serious applications. This repository acts as a database for Java tricks & general purpose helpful methods that can be imported statically.

Disclaimer: Do not use this in production applications.
(unless you are god c0dar who uses epic bools & voids on regular basis)

Installation

repositories {
    mavenCentral()
}

dependencies {
    implementation "dev.klepto.lazyvoids:lazyvoids:0.0.1"
}

Features

Library contains both useful and not-so useful utilities. Since amount of utilities is going to expand over time, the list of features is unlikely to be updated. For more information, browse this repository.

Warning: Legendary voids

when()

String number = "one";
int value = when(number)
        .map("one", 1)
        .map("two", 2)
        .orElse(0); // returns 1

runtimeThrows()

 List<URL> fileUrls = Files.walk(directory)
        .map(path -> runtimeThrows(() -> path.toUri().toURL()))
        .collect(Collectors.toList());

enumEntryMap()

public enum Item {
    SIX_CONSOLES(1337),
    GAMER_GUITAR(9001),
    DOG_CAM(420);

    @Getter private final int uid;

    Item(int uid) {
        this.uid = uid;
    }
}
Map<Integer, Item> uidToItem = enumEntryMap(Item::getUid);

Contributing

Happy voiding lads. If you have any nuclear ints make sure to create a pull request.

License

Nobody reads this bit.

About

A very non-serious utilities to be used as static imports in very non-serious projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages