Questions tagged [cactoos]

Java library of object-oriented primitives

Cactoos is an open source library that aspires to replace JDK's procedural IO, text, arrays/collections functionality with object oriented analogs.

More here: cactoos.org

11 questions
5
votes
2 answers

Refactoring Guava's Iterables.transform and Function to equivalent in Cactoos

I'm refactoring some usages of Google Guava library to Cactoos library and I'm having difficulty figuring out the equivalent implementation of both Function class and Iterables.transform method, using Cactoos library as a replacement. Example (from…
Filipe Freire
  • 823
  • 7
  • 21
3
votes
2 answers

Replace null with empty String decorator

Is there in Cactoos framework some Text decorator (or maybe some other way), which replace null string with empty string? Like Strings.nullToEmpty function in Google Guava. I have found NoNulls decorator, but I need just replacement without throwing…
maximusKon
  • 136
  • 9
3
votes
1 answer

Cactoos flatMap analogy

Is there flatMap analogy in Cactoos library? I need exactly what flatMap can, but without streams: The flatMap() operation has the effect of applying a one-to-many transformation to the elements of the stream, and then flattening the resulting…
Kirill
  • 7,580
  • 6
  • 44
  • 95
3
votes
2 answers

UncheckedIOException is thrown instead of a different expected exception

While refactoring Rultor to use Cactoos instead of Guava, I’m having an issue with negative tests of GithubProfileTest and GithubProfileValidationTest. After the refactor, the positive test cases pass for both mentioned test classes, but the…
Filipe Freire
  • 823
  • 7
  • 21
2
votes
1 answer

Read line from Stdin with Cactoos

I'm searching for an approach to read single line from Stdin using the Cactoos library. I can do something like this: System.out.println( new TextOf( new ReaderOf( new Stdin() ) ).asString() ); but this code blocks and reads…
2
votes
1 answer

Cactoos Checkstyle Configuration File

I've installed the checkstyle-idea (v8.16) for IntelliJ, there are two options of Configuration files, 'Sun Checks' and 'Google Checks'. Is there a specific file for Cactoos project? Because both default options are not working when I check all the…
tcury
  • 27
  • 4
2
votes
1 answer

How to retrieve strings from file after the blank string with cactoos?

I have a file, which is formatted like this: header line 1 header line 2 header line 3 line 1 line 2 line 3 ... I need to get Iterable with those lines (line 1, line 2, line 3 etc.), after the header. How to achieve that with the help of…
Izbassar Tolegen
  • 1,990
  • 2
  • 20
  • 37
2
votes
2 answers

Is it possible to compare 'contains' text in cactoos?

I'm looking for some sort of OO equivalent to the apache commons utility, which is the common way of handling this in java: StringUtils.containsIgnoreCase("foobar", "OOB") Is there a way to do this in cactoos? I've read through the source code and…
Chs
  • 131
  • 1
  • 6
2
votes
3 answers

Calculate SumOfInts from Iterable

I need to calculate sum of Iterable. final Iterable score = this.points() final sum = new SumOfInts(...).value() How can I do this using class SumOfInts?
funivan
  • 3,323
  • 1
  • 14
  • 19
2
votes
1 answer

Warning thrown by using multiple Iterables on Cactoos Joined class

While refactoring Rultor to use Cactoos instead of Guava, I’m having an issue with DockerRun class, in the envs method. The current refactored result is: final List entries = new LinkedList<>(); for (final Entry ent :…
Filipe Freire
  • 823
  • 7
  • 21
1
vote
1 answer

How to get lines from a file except lines starting with # using only cactoos

The task is to get all the lines from the file except the lines starting with #, using only the cactoos library. I got the following solution: Iterable data = new Filtered( (Func) text ->…