-
Notifications
You must be signed in to change notification settings - Fork 5
/
quickstart.html
206 lines (187 loc) · 7.65 KB
/
quickstart.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<!DOCTYPE html>
<html lang="en">
<head>
<title>
Functional Java
- Quickstart
</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Functional Java">
<meta name="description" content="Static blog generated with JBake">
<!-- Style -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootswatch/3.1.1/yeti/bootstrap.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.css">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css">
<link rel="stylesheet" href="/css/base.css">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="/js/html5shiv.js"></script>
<![endif]-->
<!-- Fav icon -->
<link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="/img/favicon.ico" type="image/x-icon">
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top " role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/"><img src="/img/white-lambda6.png" height="20"/> Functional Java</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="/docs.html">Docs</a></li>
<li><a href="/community.html">Community</a></li>
<li><a href="/download.html">Download</a></li>
</ul>
<!-- Right navigation -->
<ul class="nav navbar-nav navbar-right">
<li><a href="/feed.xml" title="Rss"><i class="fa fa-rss"></i> Feed</a></li>
</ul>
<!-- Right navigation end -->
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav><!-- /.navbar -->
<!-- Begin page content -->
<div class="container">
<div class="row">
<div class="col-md-12">
<article>
<h2>Quickstart</h2>
<p><div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>The latest stable version as at July 2015 is 5.0. Here is how to quickly add the library to your project and get started.</p>
</div>
<div class="paragraph">
<p>The Functional Java artifact is published to Maven Central using the group <code>org.functionaljava</code> with three published artifacts:</p>
</div>
<div class="ulist">
<ul>
<li> <p>the core library (<code>functionaljava</code>)</p> </li>
<li> <p>Quickcheck property based testing module (<code>functionaljava-quickcheck</code>)</p> </li>
<li> <p>Java core helper, a simple functional helper for java.util standard types (<code>functionaljava-java-core</code>)</p> </li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_gradle">Gradle</h2>
<div class="sectionbody">
<div class="paragraph">
<p>To add Functional Java to your Gradle project, add the following snippet to the <em>dependencies</em> section of your <code>build.gradle</code> file.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>compile "org.functionaljava:functionaljava:5.0"
compile "org.functionaljava:functionaljava-quickcheck:5.0"
compile "org.functionaljava:functionaljava-java-core:5.0"</pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_maven">Maven</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Add the following dependencies.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="prettyprint highlight"><code class="language-xml" data-lang="xml"><dependency>
<groupId>org.functionaljava</groupId>
<artifactId>functionaljava</artifactId>
<version>5.0</version>
</dependency>
<dependency>
<groupId>org.functionaljava</groupId>
<artifactId>functionaljava-quickcheck</artifactId>
<version>5.0</version>
</dependency>
<dependency>
<groupId>org.functionaljava</groupId>
<artifactId>functionaljava-java-core</artifactId>
<version>5.0</version>
</dependency></code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_first_code_example">First Code Example</h2>
<div class="sectionbody">
<div class="paragraph">
<p>We can easily map over a list to apply the same function to each element in the list and print the resulting list. Note that this uses the list <code>fj.data.List</code>.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="prettyprint highlight"><code class="language-java" data-lang="java">import static fj.data.List.list;
import fj.data.List;
import static fj.Show.intShow;
import static fj.Show.listShow;
public final class ListMapExample {
public static void main(final String[] args) {
final List<Integer> a = list(1, 2, 3).map(i -> i + 42);
listShow(intShow).println(a); // [43,44,45]
// combined into a single line
listShow(intShow).println(list(1, 2, 3).map(i -> i + 42)); // [43,44,45]
}
}</code></pre>
</div>
</div>
</div>
</div></p>
</article>
</div> <!-- /.col-md-12 -->
</div> <!-- /.row -->
</div><!-- /.container -->
<footer>
<div class="container">
<hr>
<div class="row">
<div class="col-xs-10">
<p class="text-muted credit">© 2014-2018 | Mixed with <a href="http://getbootstrap.com/">Bootstrap v3.1.1</a> | Baked with <a href="http://jbake.org">JBake v2.6.1</a> | <i title="Linux" class="fa fa-linux"></i></p>
</div>
<div class="col-xs-2 gotop">
<a href="#"><i class="fa fa-arrow-circle-up"> top</i></a>
</div>
</div>
</div>
</footer>
<!-- Placed at the end of the document so the pages load faster -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/gist-embed/1.6/gist-embed.min.js"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-28753951-2', 'auto');
ga('send', 'pageview');
</script>
<script src="//cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.js"></script>
<script type="text/javascript">
<!-- load prettify only when needed -->
$(document).ready(function(){
var prettify = false;
var classToAdd = 'prettyprint snippet';
$("pre > code").each(function() {
$("pre > code").parent().addClass(classToAdd);
prettify = true;
});
if(prettify) {
prettyPrint();
}
});
</script>
</body>
</html>