Comments (15)
@vssekorin The main constructor is code-free. But the secondary constructor can instanciate objects. Pay attention that instantiation doesn't execute any action (method executing or something like that). This will be performed later.
from cactoos.
E.g. java.lang.CharSequence interface might be used instead of org.cactoos.Text and then string consuming might be looks like
new UpperText("some java literal")
as java.lang.String already implements java.lang.CharSequence interface.
@Englishman What do you think to use a secondary constructor to it? Like:
public final class UpperText implements Text {
public UpperText(final String string) {
this(new StringAsText(string));
}
public UpperText(final Text origin) {
this.origin = origin;
}
}
from cactoos.
@Englishman I'm not managing this repo, remove the webhook or contact me in Slack //cc @yegor256
from cactoos.
if (new IsBlank(new StringAsText("java string")).asValue()) {
...
}
For me the both producing and consuming look a bit cumbersome and verbose. Is there any way to make JDK interaction smoothly?
It looks like part of the procedure.
My suggestion:
new CondProc<>(
conditional,
firstProcedure,
secondProcedure
).apply(...);
and
Type object = new Ternary<>(
conditional,
firstFunction, //Func<Something1, Type>
secondFuntion //Func<Something2, Type>
).apply(...);
But I'm not sure about this completely. We had to wait for @yegor256 reply.
from cactoos.
@vssekorin yes, I thought about the such approach but you suggestion is a substitute of Java lang standard if
statement. So Cactoos will be kind of a framework but not a library then.
BTW here
new CondProc<>(
conditional,
firstProcedure,
secondProcedure
).apply(...);
what are apply
method params?
from cactoos.
It's OO primitives library, I have proposed OO analog if
.
what are apply method params?
Type object = new Ternary<>(
conditional, //Func.Pred<Some1>
first, //Func<Some2, Type>
second //Func<Some3, Type>
).apply(Some1 arg1, Some2 arg2, Some3 arg3);
(My example is wrong. I used it to explain the idea.)
from cactoos.
@yegor256 WDYT? Pls, share you strategical opinion here.
from cactoos.
@Englishman I think we should try to stay as far away from JDK "things" as we can. Otherwise, we will just create another Guava. That's why that Scalar
and others. Of course, we can add implements Number
to, say, LengthOfIterable
, for extra convenience. Feel free to submit a PR.
from cactoos.
@fabriciofx What about Constructors Must Be Code-Free? I'm not sure that this is the right solution.
from cactoos.
@fabriciofx like your idea! At least, we'll have a cheap one-way of JDK interaction.
from cactoos.
@vssekorin @fabriciofx but look on this discussion.
#20 (comment)
It's not about new
in ctors. It's about some code. WDYT?
Added separate issue #62 for this
from cactoos.
@Englishman I believe this issue no longer applies. We now have TextOf(CharSequence)
; we can also do new UpperText(Text)
or new UpperText(() -> "your string")
. Can we close this?
from cactoos.
@Englishman can we close this?
from cactoos.
@Englishman closing
from cactoos.
The job is not in WBS, won't close the order
from cactoos.
Related Issues (20)
- IoCheckedBytes HOT 6
- Immutable.java:36-38: Replace all the... HOT 2
- BiFuncEnveloppe - typo?
- refresh HOT 4
- RunnableOf(Callable) would be nice to have HOT 8
- tag missing problem
- Dependency Dashboard
- extra ctor for Reduced HOT 4
- Example of iteration HOT 4
- new text manipulators HOT 2
- Bad formatting HOT 1
- Bad performance locking HOT 5
- build failed on java 21+ HOT 3
- Can we move `SlowInputStream.java` to production classes?
- Let's implement a Multiline Text HOT 4
- Update copyright year HOT 1
- AppendToTest.java:71-72: Tests failed on Windows due to...
- missing analog for ExceptionUtils HOT 1
- missing analog to get substring from the end of the line
- missing analog for StringUtils.splitPreserveAllTokens
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cactoos.