You need to sign in to do that
Don't have an account?
filtering http response lambda expression
say if we have 100 objects
[
{“ECN”:10001, “PCN”:”2131932199”, “RoleType”=”PNI”},
{“ECN”:10002, “PCN”:”2131932199”, “RoleType”=”PNI”},
.
.
.
{“ECN”:10099, “PCN”:”2131932199”, “RoleType”=”SNI”},
{“ECN”:10100, “PCN”:”2131932199”, “RoleType”=”SNI”}
]
If I want to take the object having the ECN value as 10099, how should I take it using single line of code instead of looping all the elements.
In JAVA, it can be done through lambda expression in one line of code. Please check the feasibility.
[
{“ECN”:10001, “PCN”:”2131932199”, “RoleType”=”PNI”},
{“ECN”:10002, “PCN”:”2131932199”, “RoleType”=”PNI”},
.
.
.
{“ECN”:10099, “PCN”:”2131932199”, “RoleType”=”SNI”},
{“ECN”:10100, “PCN”:”2131932199”, “RoleType”=”SNI”}
]
If I want to take the object having the ECN value as 10099, how should I take it using single line of code instead of looping all the elements.
In JAVA, it can be done through lambda expression in one line of code. Please check the feasibility.
I used R.apex and that works. I deleted all the loops as you want for your question.
https://github.com/Click-to-Cloud/R.apex
I have deployed all these classes but for only R.apex, you could deployed less classes.
All Answers
https://json2apex.herokuapp.com/
Apex is closed for the "imports" (like the imports of jars in java) but you can create an invocable object camouflaged as a function, and it is referred to as a Func.
R.apex is a functional library based on Apex, inspired by Lodash and Ramda.js.
https://github.com/Click-to-Cloud/R.apex/
It is a recent project.
Apex does not support first class functions, and we have NO WAY to get around it. However, we can create an invocable object camouflaged as a function, and it is referred to as a Func. Or more precisely, it is an instance of class Func. In R.apex, we roughly refer to instances of Func when we mention functions, to make things clear.
Another thing to notice is that in functional programming, we tend to put the data we are manipulating in the last position in the argument list. For example, R.filter.run(R.isNotNull, myList);
Flow.apex is a library to help you weave functions in a procedural style.
Why Flow.apex? Flow.apex is created to simplify the creation of a Function. It simulates the procedural invocation of Functions, and weave them to build a larger and more complicated Function. Flow.apex acts as a bridge between the small Funcs and big custom Funcs that you create by subclassing Func
Object result = Flow.eval('product(1, 2, 3, 4)');.
Flow f = new Flow() .inputAs('a', 'b').returnInteger() .doIf( 'a == 1', Flow.block().doReturn(1) );
https://github.com/Click-to-Cloud/Flow.apex
https://clicktocloud.com/
I used R.apex and that works. I deleted all the loops as you want for your question.
https://github.com/Click-to-Cloud/R.apex
I have deployed all these classes but for only R.apex, you could deployed less classes.
https://www.ctcproperty.com/About.html
Their Github repository is really great: https://github.com/Click-to-Cloud