Skip to content

Commit 2edc668

Browse files
committed
Add LazyString.toString: F<LazyString, String> as first-class conversion from lazy strings to String.
1 parent 02580b1 commit 2edc668

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

core/src/main/java/fj/data/LazyString.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,16 @@ public Stream<Character> f(final LazyString string) {
316316
}
317317
};
318318

319+
/**
320+
* First-class conversion from lazy strings to String.
321+
*/
322+
public static final F<LazyString, String> toString =
323+
new F<LazyString, String>() {
324+
public String f(final LazyString string) {
325+
return string.toString();
326+
}
327+
};
328+
319329
/**
320330
* First-class conversion from character streams to lazy strings.
321331
*/

0 commit comments

Comments
 (0)