Questions tagged [functional-java]

Functional Java is is an open source library to learn and implement functional programming concepts in Java.

From the functional Java website: Functional Java is an open source library that seeks to improve the experience of using the Java programming language in a production environment.

The library implements several advanced programming concepts that assist in achieving composition-oriented development. Functional Java is written using vanilla Java 1.5 syntax and requires no external supporting libraries. The JAR file will work with your Java 1.5 project without any additional effort. Functional Java also serves as a platform for learning functional programming concepts by introducing these concepts using a familiar language.

Functional Java's code is now hosted on github

48 questions
13
votes
3 answers

Is there a good comparison between Functional Java and Guava?

I'd like to use either Functional Java or Guava (or less likely Scala) in a course I'll be teaching. Although there are lots of functional languages that run on the JVM I'd like to stick to something that looks as much like Java as possible, i.e.,…
RussAbbott
  • 2,660
  • 4
  • 24
  • 37
11
votes
1 answer

What are your experiences using the functional java project?

I was reading the following question - How safe would it be to use functional-java to add closures to a Java production project? and I had been thinking of using the Functional Java project as well in my current project. I was wondering what are…
Elijah
  • 13,368
  • 10
  • 57
  • 89
10
votes
2 answers

In FunctionalJava.List, what does "snoc" mean?

FunctionJava's List class has a snoc method that does append: snoc The description is as follows: Appends (snoc) the given element to this list to produce a new list. What does the word "snoc" here mean? I have tried to look it up in Wikipedia and…
John B
  • 32,493
  • 6
  • 77
  • 98
7
votes
5 answers

How to count vowels in Java through functional programming?

I need to count the number of vowels in a list of words in Functional Java. If I have this list: List l = Arrays.asList("hello", "world", "test"); My idea was to "delete" the vowels and then do a subtraction this way: int tot =…
6
votes
1 answer

Anything in Guava similar to Functional Java's Effect?

I know one of the goals of pure functional programming is to eliminate mutability, and therefore to preclude side-effects. But let's face it, Java is not a functional language even with all of the functional-programming libraries that exist. In…
Kevin Welker
  • 7,719
  • 1
  • 40
  • 56
6
votes
6 answers

How safe would it be to use functional-java to add closures to a Java production project?

I would love to use closures in Java. I have read that they may or may not make it into Java 7. But an open-source project called functional-java has implemented functional features including closures. How safe would it be to use such a library in…
Harry Quince
  • 2,394
  • 3
  • 15
  • 11
6
votes
3 answers

Mapping a FunctionalJava Option with Hibernate

I have a hibernate-mapped Java object, JKL, which is full of a bunch of normal hibernate-mappable fields (like strings and integers). I'm added a new embedded field to it (which lives in the same table -- not a mapping), asdf, which is a…
Mike Cialowicz
  • 9,892
  • 9
  • 47
  • 76
5
votes
2 answers

Either for error handling in java

My new workplace is heavily using functional java Either for its error handling (http://www.functionaljava.org/javadoc/4.5/functionaljava/fj/data/Either.html). exceptions are almost not used at all. This is very annoying imo for many reasons. To…
yaarix
  • 490
  • 7
  • 18
4
votes
3 answers

Java 8 Lambdas flatmapping, groupingBy and mapping to get a Map of T and List

Here's what I have so far: Map> mapOf = quickSearchList .stream() .map(QuickSearch::getFacility) .collect(Collectors.flatMapping(facility ->…
Anjil Dhamala
  • 1,544
  • 3
  • 18
  • 37
4
votes
3 answers

Where can I find a repository containing functionaljava 3.0?

I would like to use functional Java 3.0 in a maven project. I have been googling a little, but I can't find valid information to include the corresponsding 'dependency' in my pom.xml. Someone mentioned that he would upload the artifacts to the…
Jérôme Verstrynge
  • 57,710
  • 92
  • 283
  • 453
4
votes
3 answers

Filtering on Java 8 List

I have a list of type List in functional java using List type provided by fj.data.List import fj.data.List List managedCustomers I am trying to filter it using the following: managedCustomers.filter(customerId -> customerId ==…
Nir Ben Yaacov
  • 1,182
  • 2
  • 17
  • 33
3
votes
3 answers

Java FoldMap Lists, or "how to get around the lazy/eager dissonance"

I am porting this package to Java and have gotten stuck trying to get around the lazy/eager dissonance between the two languages. I didn't think it was going to be as severe as it is because the implementation depends entirely on function types,…
Ptharien's Flame
  • 3,246
  • 20
  • 24
3
votes
4 answers

How to compose Function and Consumer in Java 8?

Why can't we compose Function and Consumer just like we compose functions? Function a = Object::toString; Consumer b = x -> System.out.println(x); Consumer composed = a.andThen(b); This seems like an obvious…
ant_1618
  • 1,861
  • 4
  • 17
  • 26
3
votes
1 answer

Using Fugue/FunctionalJava to Move Away From Null and Throws?

Okay, so I'm a long time OO developer trying to get into this "newfound" world of functional programming - at the very least, as it pertains to this, I'm trying to code like null and throw don't exist in Java land by playing around with Option and…
MCory
  • 437
  • 2
  • 13
2
votes
2 answers

Functional Programming Dependencies: How to share dependencies between functions that aren't connected together direct

these different functions are composed together like so f1 -> f2 -> f3 -> f4 -> f5 I need to add two new functions fx and fy around f3 like so: f1 -> f2 -> fx -> f3 -> fy -> f4 -> f5 so I need to pre-process the argument for f3 and then…
1
2 3 4