Skip to content

Commit 74fa5d2

Browse files
committed
JavaDoc updated
1 parent 4410334 commit 74fa5d2

File tree

5 files changed

+656
-38
lines changed

5 files changed

+656
-38
lines changed

pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
<!-- as in http://stackoverflow.com/a/23543181/1399395 -->
5252
<additionalparam>-Xdoclint:none</additionalparam>
5353
<bottom><![CDATA[Copyright &#169; {inceptionYear}&#x2013;{currentYear}, <a href="http://www.codebulb.ch">codebulb.ch<a>. All rights reserved.]]></bottom>
54+
<!-- copy additional javadoc folder resources -->
55+
<docfilessubdirs>true</docfilessubdirs>
5456
</configuration>
5557
<!-- attach JavaDoc for JitPack distribution -->
5658
<!-- as in https://github.com/jitpack/maven-simple/blob/master/pom.xml -->
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
/**
2-
* Contains the main classes. Abstractions are placed in a sub-package.
2+
* Contains the main classes. Abstractions are placed in a sub-package.<p>
3+
*
4+
* The following image illustrates how the most important main classes and their abstractions are related:
5+
*
6+
* <div style="clear: both; text-align: center;" class="separator">
7+
<img border="0" src="../../../resources/classDiagram.png">
8+
</div>
39
*/
410
package ch.codebulb.lambdaomega;

src/main/javadoc/overview.html

Lines changed: 64 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,53 +7,57 @@
77

88
<p><i>From <a href="https://github.com/codebulb/LambdaOmega">the project's GitHub repository's documentation:</a></i></p>
99

10-
<h2><a id="user-content-whats-in-the-box" class="anchor" href="#whats-in-the-box" aria-hidden="true"><span class="octicon octicon-link"></span></a>What’s in the box?</h2>
10+
<h2><a aria-hidden="true" href="#whats-in-the-box" class="anchor" id="user-content-whats-in-the-box"><span class="octicon octicon-link"></span></a>What’s in the box?</h2>
1111

1212
<p>LambdaOmega consists of only a few classes. For brevity reasons, most of their names consist of a single letter.</p>
1313

1414
<ul>
15-
<li> <code>L</code> (“List”) is a wrapper for List.</li>
16-
<li> <code>M</code> (“Map”) is a wrapper for Map.</li>
17-
<li> <code>S</code> (“Set”) is a wrapper for Set.</li>
18-
<li> <code>R</code> (“Range”) is a wrapper for an IntStream range.</li>
19-
<li> <code>V2</code> (“Vector 2D”) represents a 2D vector (= a 2-ary tuple). It can be converted into a Map.Entry.</li>
20-
<li> <code>F</code> (“Function”) is a wrapper for functional interfaces (lambda expressions) which also provides helper methods to convert functions.</li>
21-
<li> <code>C</code> (“Collection”) is the base class for L and M and provides additional helper methods to convert collections.</li>
22-
<li> <code>U</code> (“Utils”) provides additional miscellaneous helper methods.</li>
23-
<li> <code>Promise</code> is a wrapper and a drop-in replacement for CompletableFuture, providing several simplifications and fixes for the API. It can be used independently of all the other classes. It’s discussed in a separate section.</li>
15+
<li><code>L</code> (“List”) is a wrapper for List.</li>
16+
<li><code>M</code> (“Map”) is a wrapper for Map.</li>
17+
<li><code>S</code> (“Set”) is a wrapper for Set.</li>
18+
<li><code>R</code> (“Range”) is a wrapper for an IntStream range.</li>
19+
<li><code>V2</code> (“Vector 2D”) represents a 2D vector (= a 2-ary tuple). It can be converted into a Map.Entry.</li>
20+
<li><code>F</code> (“Function”) is a wrapper for functional interfaces (lambda expressions) which also provides helper methods to convert functions.</li>
21+
<li><code>C</code> (“Collection”) is the base class for L and M and provides additional helper methods to convert collections.</li>
22+
<li><code>U</code> (“Utils”) provides additional miscellaneous helper methods.</li>
23+
<li><code>Promise</code> is a wrapper and a drop-in replacement for CompletableFuture, providing several simplifications and fixes for the API. It can be used independently of all the other classes. It’s discussed in a separate section.</li>
2424
</ul>
2525

26-
<h2><a id="user-content-why-you-should-use-it" class="anchor" href="#why-you-should-use-it" aria-hidden="true"><span class="octicon octicon-link"></span></a>Why you should use it</h2>
26+
<h2><a aria-hidden="true" href="#why-you-should-use-it" class="anchor" id="user-content-why-you-should-use-it"><span class="octicon octicon-link"></span></a>Why you should use it</h2>
2727

2828
<ul>
29-
<li> Although Java’s Collections / lambdas are everywhere, you feel like their API is really cumbersome.</li>
30-
<li> You feel even more so if you know and love Groovy or JavaScript / lodash.</li>
31-
<li> It perfectly fits unit tests where fluid, maintainable code is key.</li>
29+
<li>Although Java’s Collections / lambdas are everywhere, you feel like their API is really cumbersome.</li>
30+
<li>You feel even more so if you know and love Groovy or JavaScript / lodash.</li>
31+
<li>It perfectly fits unit tests where fluid, maintainable code is key.</li>
3232
</ul>
3333

3434
<p>Other benefits:</p>
3535

3636
<ul>
37-
<li> Small footprint (JAR &lt; 85KB), no other dependencies.</li>
38-
<li> Thoroughly tested (coverage &gt; 80%).</li>
39-
<li> Human-readable documentation (here and in the API docs).</li>
40-
<li> Free &amp; Open source (<a href="https://github.com/codebulb/LambdaOmega/blob/master/LICENSE">New BSD license</a>).</li>
37+
<li>Small footprint (JAR &lt; 85KB), no other dependencies.</li>
38+
<li>Thoroughly tested (coverage &gt; 80%).</li>
39+
<li>Human-readable documentation (here and in the API docs).</li>
40+
<li>Free &amp; Open source (<a href="https://github.com/codebulb/LambdaOmega/blob/master/LICENSE">New BSD license</a>).</li>
4141
</ul>
4242

43-
<h2><a id="user-content-how-to-use-it" class="anchor" href="#how-to-use-it" aria-hidden="true"><span class="octicon octicon-link"></span></a>How to use it</h2>
43+
<h2><a aria-hidden="true" href="#how-to-use-it" class="anchor" id="user-content-how-to-use-it"><span class="octicon octicon-link"></span></a>How to use it</h2>
4444

4545
<p>Use <a href="https://jitpack.io/">JitPack</a> to add its dependency to your Maven project:</p>
4646

4747
<pre><code>&lt;dependency&gt;
4848
&lt;groupId&gt;com.github.codebulb&lt;/groupId&gt;
4949
&lt;artifactId&gt;LambdaOmega&lt;/artifactId&gt;
50-
&lt;version&gt;0.1_RC-2&lt;/version&gt;
50+
&lt;version&gt;0.1&lt;/version&gt;
5151
&lt;/dependency&gt;
5252
</code></pre>
5353

54-
<p>Replace the version by the tag / commit hash of your choice or <code>-SNAPSHOT</code> to get the newest SNAPSHOT. Visit <a href="https://jitpack.io/docs/">JitPack's docs</a> for more information.</p>
54+
<p>Replace the version by the tag / commit hash of your choice or <code>-SNAPSHOT</code> to get the newest SNAPSHOT.</p>
5555

56-
<h2><a id="user-content-getting-started-with-collections" class="anchor" href="#getting-started-with-collections" aria-hidden="true"><span class="octicon octicon-link"></span></a>Getting started with Collections</h2>
56+
<p>Not using Maven? You can <a href="https://jitpack.io/com/github/codebulb/LambdaOmega/0.1/LambdaOmega-0.1.jar">download the JAR directly from JitPack’s servers</a>.</p>
57+
58+
<p>Visit <a href="https://jitpack.io/docs/">JitPack’s docs</a> for more information.</p>
59+
60+
<h2><a aria-hidden="true" href="#getting-started-with-collections" class="anchor" id="user-content-getting-started-with-collections"><span class="octicon octicon-link"></span></a>Getting started with Collections</h2>
5761

5862
<p>The heart of LambdaOmega are the wrapper classes <code>L</code> and <code>M</code> which wrap around vanilla Java Collection <code>List</code> or <code>Map</code>, respectively (decorator pattern) to provide a more concise and more enjoyable API to the underlying collection.
5963
You can wrap an L around everything which can be turned into a List: a List, a <code>Stream</code>, varargs:</p>
@@ -112,14 +116,14 @@ <h2><a id="user-content-getting-started-with-collections" class="anchor" href="#
112116
<pre><code>Map&lt;String, Integer&gt; map = m("a", 0).Insert("b", 1).i("c", 2).m;
113117
</code></pre>
114118

115-
<p>(we cover Map' <code>insert()</code> method in a bit.)</p>
119+
<p>(we cover Map’s <code>insert()</code> method in a bit.)</p>
116120

117121
<p>There’s a two-arg constructor for empty Maps of an explicit key / value type. If the “key” class is omitted, it’s assumed to be String:</p>
118122

119123
<pre><code>M&lt;String, Integer&gt; emptyM = m(Integer.class);
120124
</code></pre>
121125

122-
<h2><a id="user-content-collection-methods" class="anchor" href="#collection-methods" aria-hidden="true"><span class="octicon octicon-link"></span></a>Collection methods</h2>
126+
<h2><a aria-hidden="true" href="#collection-methods" class="anchor" id="user-content-collection-methods"><span class="octicon octicon-link"></span></a>Collection methods</h2>
123127

124128
<p>None of the LambdaOmega collections implements Java’s Collection or Map interface, for two reasons:</p>
125129

@@ -172,7 +176,7 @@ <h2><a id="user-content-collection-methods" class="anchor" href="#collection-met
172176

173177
<p>There are a lot of additional methods for L and M. For more information, visit the API docs.</p>
174178

175-
<h2><a id="user-content-a-list-is-a-map-and-a-map-is-a-list" class="anchor" href="#a-list-is-a-map-and-a-map-is-a-list" aria-hidden="true"><span class="octicon octicon-link"></span></a>A List is a Map and a Map is a List</h2>
179+
<h2><a aria-hidden="true" href="#a-list-is-a-map-and-a-map-is-a-list" class="anchor" id="user-content-a-list-is-a-map-and-a-map-is-a-list"><span class="octicon octicon-link"></span></a>A List is a Map and a Map is a List</h2>
176180

177181
<p>Now comes the fun part. Because the LambdaOmega API lives independently of vanilla Java Collection / Map API, it features its own API which is more simple, consistent and powerful at the same time, whilst keeping it as close to the original Java APIs as possible.</p>
178182

@@ -197,7 +201,7 @@ <h2><a id="user-content-a-list-is-a-map-and-a-map-is-a-list" class="anchor" href
197201
b = indexed.g(1);
198202
</code></pre>
199203

200-
<h2><a id="user-content-collection-methods-with-lambdas" class="anchor" href="#collection-methods-with-lambdas" aria-hidden="true"><span class="octicon octicon-link"></span></a>Collection methods with Lambdas</h2>
204+
<h2><a aria-hidden="true" href="#collection-methods-with-lambdas" class="anchor" id="user-content-collection-methods-with-lambdas"><span class="octicon octicon-link"></span></a>Collection methods with Lambdas</h2>
201205

202206
<p>One of the main reasons to use LambdaOmega are the simplifications to use collections with lambda expressions in functional programming. When compared with vanilla Java lambda use, the API is much more simple and concise. Many of these modifications are inspired by the equivalent Groovy semantics.</p>
203207

@@ -249,9 +253,9 @@ <h2><a id="user-content-collection-methods-with-lambdas" class="anchor" href="#c
249253
println(withDefault); // prints M{a=L[1]}
250254
</code></pre>
251255

252-
<p>Take a look at the API docs to see all available functional operations.</p>
256+
<p>Take a look at the API docs to see all available functional operations .</p>
253257

254-
<h2><a id="user-content-functions" class="anchor" href="#functions" aria-hidden="true"><span class="octicon octicon-link"></span></a>Functions</h2>
258+
<h2><a aria-hidden="true" href="#functions" class="anchor" id="user-content-functions"><span class="octicon octicon-link"></span></a>Functions</h2>
255259

256260
<p>The <code>F</code> class serves as a simple wrapper around any kind of <code>FunctionalInterface</code>, providing a unified API to any kind of function:</p>
257261

@@ -268,7 +272,7 @@ <h2><a id="user-content-functions" class="anchor" href="#functions" aria-hidden=
268272

269273
<p>…expect more FunctionalInterface transformations in future LambdaOmega releases!</p>
270274

271-
<h2><a id="user-content-ranges" class="anchor" href="#ranges" aria-hidden="true"><span class="octicon octicon-link"></span></a>Ranges</h2>
275+
<h2><a aria-hidden="true" href="#ranges" class="anchor" id="user-content-ranges"><span class="octicon octicon-link"></span></a>Ranges</h2>
272276

273277
<p>The <code>R</code> class represents an int range. It’s basically syntactic sugar to create ranges using the Java 8 stream API.</p>
274278

@@ -282,7 +286,7 @@ <h2><a id="user-content-ranges" class="anchor" href="#ranges" aria-hidden="true"
282286
<pre><code>List&lt;String&gt; listBcd = l("a", "b", "c", "d", "e").get(r(1).to(3));
283287
</code></pre>
284288

285-
<h2><a id="user-content-2d-vectors" class="anchor" href="#2d-vectors" aria-hidden="true"><span class="octicon octicon-link"></span></a>2D vectors</h2>
289+
<h2><a aria-hidden="true" href="#2d-vectors" class="anchor" id="user-content-2d-vectors"><span class="octicon octicon-link"></span></a>2D vectors</h2>
286290

287291
<p>The V2 class represents a 2-dimensional vector = a 2-ary tuple:</p>
288292

@@ -294,25 +298,48 @@ <h2><a id="user-content-2d-vectors" class="anchor" href="#2d-vectors" aria-hidde
294298
<pre><code>V2.LV2&lt;String, Integer&gt; vector2 = v("a", 0).a("a", 1);
295299
</code></pre>
296300

297-
<h2><a id="user-content-promises" class="anchor" href="#promises" aria-hidden="true"><span class="octicon octicon-link"></span></a>Promises</h2>
301+
<h2><a aria-hidden="true" href="#promises" class="anchor" id="user-content-promises"><span class="octicon octicon-link"></span></a>Promises</h2>
298302

299303
<p>This library also features a drop-in-replacement for CompletableFuture, simplifying and fixing its partially flawed API. I went into some more details in the <a href="http://www.codebulb.ch/2015/08/lambdaomega-java-collections-lambdas-promises-simplified.html#drop-in-replacement">accompanying blog post</a>.</p>
300304

301-
<h2><a id="user-content-project-status-and-future-plans" class="anchor" href="#project-status-and-future-plans" aria-hidden="true"><span class="octicon octicon-link"></span></a>Project status and future plans</h2>
305+
<h2><a aria-hidden="true" href="#things-to-consider-and-best-practices" class="anchor" id="user-content-things-to-consider-and-best-practices"><span class="octicon octicon-link"></span></a>Things to consider and Best practices</h2>
306+
307+
<ul>
308+
<li><strong>Performance</strong>: LambdaOmega doesn’t make use of reflection. It really just wraps Collection API method calls and should perform similarly to vanilla API calls.
309+
310+
<ul>
311+
<li>However, intermediate operations on LambdaOmega collections will always create a new Collection much unlike vanilla Java collections which just operate on a stream: <code>l(0, 1, 2).Map(it -&gt; it + 1).map(it -&gt; it * 2); // Creates a new Collection on #l(…), #Map(…) and #map(…)</code> This may decrease performance for big collections. Thus, even though LambdaOmega should perform OK in everyday situations, keep in mind that it is not and will never be built primarily for speed.</li>
312+
</ul></li>
313+
<li>LambdaOmega is not built as a replacement for any of the Java core classes / interfaces. It’s hence best practice to use LambdaOmega collections and other abstractions locally only for the coder’s convenience and to not expose them in a public API to reduce dependency on this library.</li>
314+
<li>However, LambdaOmega fits perfectly where you make intense use of Java’s collection API and keeping your code clean and concise is key. It’s thus especially useful for e.g. JUnit test code which typically involves lots of collection boilerplate code.</li>
315+
</ul>
316+
317+
<h2><a aria-hidden="true" href="#project-status-and-future-plans" class="anchor" id="user-content-project-status-and-future-plans"><span class="octicon octicon-link"></span></a>Project status and future plans</h2>
302318

303-
<p>As of V. 0.1 RC-2, RELEASE is imminent, and feedback is welcome.</p>
319+
<p>LambdaOmega is now RELEASED, feedback is welcome.</p>
304320

305-
<p>Please feel free to submit bug reports / feature requests or make your own contribution to the project.</p>
321+
<p>I will use the issue tracker to plan features for future releases. Feel free to use it to submit feature requests or bug reports, or make your own contribution to the project.</p>
306322

307323
<p>This is a private project I’ve started for my own pleasure and usage and to learn more about Java 8’s collection API, and I have no plans for (commercial) support. I decided to publish it open sourced so that everyone who is interested is free to use it at his own discretion.</p>
308324

309-
<h2><a id="user-content-for-more-information" class="anchor" href="#for-more-information" aria-hidden="true"><span class="octicon octicon-link"></span></a>For more information</h2>
325+
<h2><a aria-hidden="true" href="#version-history" class="anchor" id="user-content-version-history"><span class="octicon octicon-link"></span></a>Version history</h2>
326+
327+
<ul>
328+
<li>V. 0.2:
329+
330+
<ul>
331+
<li><a href="https://github.com/codebulb/LambdaOmega/issues/1">F enhancements</a>: Support for all <code>FunctionalInterface</code>s and more transformations in the <code>F</code> class.</li>
332+
</ul></li>
333+
<li>V. 0.1: First release</li>
334+
</ul>
335+
336+
<h2><a aria-hidden="true" href="#for-more-information" class="anchor" id="user-content-for-more-information"><span class="octicon octicon-link"></span></a>For more information</h2>
310337

311338
<p>Please visit the <strong><a href="http://www.codebulb.ch/2015/08/lambdaomega-java-collections-lambdas-promises-simplified.html">accompanying blog post</a></strong> to learn more about why I created this library or check out the API docs:</p>
312339

313340
<ul>
314-
<li> <strong><a href="http://codebulb.github.io/pages/LambdaOmega/doc/0.1_RC-2/">V. 0.1 RC-2 docs</a></strong></li>
315-
<li> <strong><a href="http://codebulb.github.io/pages/LambdaOmega/doc/">Current SNAPSHOT docs</a></strong></li>
341+
<li><strong><a href="http://codebulb.github.io/pages/LambdaOmega/doc/0.1/">V. 0.1 docs</a></strong></li>
342+
<li><strong><a href="http://codebulb.github.io/pages/LambdaOmega/doc/">Current SNAPSHOT docs</a></strong></li>
316343
</ul>
317344

318345
<p>Visit <a href="https://github.com/codebulb/LambdaOmega">the project's GitHub repository</a> for basic usage information.</p>
38.9 KB
Loading

0 commit comments

Comments
 (0)