https://github.com/diffplug/durian
Guava's spikier (unofficial) cousin
https://github.com/diffplug/durian
Last synced: 7 months ago
JSON representation
Guava's spikier (unofficial) cousin
- Host: GitHub
- URL: https://github.com/diffplug/durian
- Owner: diffplug
- License: apache-2.0
- Created: 2015-04-18T23:07:38.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-08-19T08:17:29.000Z (over 9 years ago)
- Last Synced: 2025-04-08T16:02:03.107Z (9 months ago)
- Language: Java
- Homepage:
- Size: 24.1 MB
- Stars: 288
- Watchers: 15
- Forks: 26
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
#
Durian: [Guava](https://github.com/google/guava)'s spikier (unofficial) cousin
[](https://bintray.com/diffplug/opensource/durian/view)
[](https://github.com/diffplug/durian/releases/latest)
[](https://diffplug.github.io/durian/javadoc/3.4.0/)
[](https://tldrlegal.com/license/apache-license-2.0-(apache-2.0))
[](CHANGES.md)
[](https://travis-ci.org/diffplug/durian)
[](https://gitter.im/diffplug/durian)
Guava has become indispensable for many Java developers. Because of its wide adoption, it must be conservative regarding its minimum requirements.
Durian complements Guava with some features which are too spiky for Guava, such as:
* [One-liner exception handling](test/com/diffplug/common/base/ErrorsExample.java?ts=4) for Java 8 functional interfaces (even with checked exceptions).
* A [simple replacement](https://diffplug.github.io/durian/javadoc/3.4.0/com/diffplug/common/base/StringPrinter.html) for the mess of `PrintStream`, `OutputStream`, `Writer`, etc. when all you want is to pipe some strings around.
* Given a node in a tree, and a [`Function>`](https://diffplug.github.io/durian/javadoc/3.4.0/com/diffplug/common/base/TreeDef.html), create a `Stream` for [traversing](test/com/diffplug/common/base/TreeStreamTest.java?ts=4) this tree (breadth-first, depth-first, etc.).
* An [enum for handling comparisons](https://diffplug.github.io/durian/javadoc/3.4.0/com/diffplug/common/base/Comparison.html) in a pattern-matchey way.
* Guava's [`Suppliers`](https://diffplug.github.io/durian/javadoc/3.4.0/com/diffplug/common/base/Suppliers.html),
[`Predicates`](https://diffplug.github.io/durian/javadoc/3.4.0/com/diffplug/common/base/Predicates.html),
and [`Functions`](https://diffplug.github.io/durian/javadoc/3.4.0/com/diffplug/common/base/Functions.html) converted to Java 8,
and a new [`Consumers`](https://diffplug.github.io/durian/javadoc/3.4.0/com/diffplug/common/base/Consumers.html) class to round it out.
* A few other carefully-curated Java 8 goodies:
+ [Box and Box.Nullable](src/com/diffplug/common/base/Box.java?ts=4)
+ [Either](https://diffplug.github.io/durian/javadoc/3.4.0/com/diffplug/common/base/Either.html)
+ [StackDumper](https://diffplug.github.io/durian/javadoc/3.4.0/com/diffplug/common/base/StackDumper.html)
+ [MoreCollectors](https://diffplug.github.io/durian/javadoc/3.4.0/com/diffplug/common/base/MoreCollectors.html)
+ [FieldsAndGetters](https://diffplug.github.io/durian/javadoc/3.4.0/com/diffplug/common/base/FieldsAndGetters.html)
Durian's only requirement is Java 8 or greater, no other libraries are needed (not even Guava).
Contributions are welcome, see [the contributing guide](CONTRIBUTING.md) for development info.
## Related
If you have a `Box`, but you'd like to subscribe to changes in its value, you should look at `RxBox` in [DurianRx](https://github.com/diffplug/durian-rx).
## Acknowledgements
* The API and tests for `Suppliers`, `Functions`, and `Predicates` are all verbatim from [Guava](https://github.com/google/guava).
* `StringPrinter.toOutputStream()` borrows heavily from `WriterOutputStream`, inside Apache commons-io.
* `DurianPlugins` is inspired by RxJava's plugin mechanism.
* Formatted by [spotless](https://github.com/diffplug/spotless), [as such](https://github.com/diffplug/durian/blob/v2.0/build.gradle?ts=4#L70-L90).
* Bugs found by [findbugs](http://findbugs.sourceforge.net/), [as such](https://github.com/diffplug/durian/blob/v2.0/build.gradle?ts=4#L92-L116).
* OSGi metadata generated by [goomph](https://github.com/diffplug/goomph), which leverages Peter Kriens' [bnd](http://www.aqute.biz/Bnd/Bnd).
* Scripts in the `.ci` folder are inspired by [Ben Limmer's work](http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/).
* Built by [gradle](http://gradle.org/).
* Tested by [junit](http://junit.org/).
* Maintained by [DiffPlug](http://www.diffplug.com/).