0

I'm trying to understand lambdaj library in order to use functional style programming in java. Their wiki page example uses a function called asList which I don't see in any of the lambda packages.

I'm using lambdaj 2.4 version and I'm referring to https://code.google.com/p/lambdaj/wiki/LambdajFeatures

Am I missing anything here ? Is it a function that is assumed to be written by the users of the library?

Romano Zumbé
  • 7,893
  • 4
  • 33
  • 55
user378101
  • 649
  • 3
  • 12
  • 19

1 Answers1

1

The asList() function is in the java.util.Arrays class. It acts as bridge between array-based and collection-based APIs.

If you don't want to clutter the code with qualifier references (i.e. "Arrays.") you can import the method via a static import import static java.util.Arrays.asList;

pfranza
  • 3,292
  • 2
  • 21
  • 34
  • I'm aware of this API. Arrays.asList(). I suspect that is not what the wiki example intended. Had that been the case, they should have very well said Arrays.asList instead of the short form. I'm expecting a asList function (static import) just like filter,having,foreach functions – user378101 Sep 03 '14 at 12:34
  • If want to access it as a static import then you just have to call "import static java.util.Arrays.asList;" Additionally the comments on the wiki page reference a requested change of "Arrays.asList instead of asList, this can be confusing to Java newbies" showing that Arrays.asList(..) is the correct intention. – pfranza Sep 03 '14 at 12:37