Win a copy of Kotlin Cookbook this week in the Kotlin forum!

Suryanarayana Murthy Maganti

+ Follow
since Apr 09, 2012
Suryanarayana Murthy likes ...
Eclipse IDE Hibernate Oracle
I am Maganti Suryanarayana Working as an senior software Engineer from Hyderabad, India.
Hyderabad, India
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Suryanarayana Murthy Maganti

Hi Swapna,

The following is the code which is self explanatory in regard to api:

Swapna latha wrote:
Thank you very much Ankit. I do have one more doubt, i am confused about api aslo before and after for compose and andThen method. But your way of explanation is vrey good.

Ankit Garg wrote:The order is quite simple, when you use compose, the inner function is called first, then the outer function is called with the result of the inner function.
Let's create two methods which we'll call with and without Lambda:
EDIT - modifying the example to change return type
Now lets call them without Lambda
This code calls the intToStr function with an Integer value, the resulting String is passed to the strToLong function which converts the String value to Long. In simple terms, with Lambda this can be achieved in two ways (below lines are not code but just explaining the API)

Another important point is the resulting function that you get when you call compose. In the above case, after calling compose (or andThen but with reverse parameters), you get a function which takes an Integer as parameter and returns a Long. The way it happens is, first intToStr is called which takes the integer and converts it into a String, then strToLong is called and it converts the String to Long. So it would work something like this
intToLong = strToLong.compose(intToStr);
Integer i = 20;
Long l = intToLong(i)


Best way to prepare for certification is to practice programs and commit them to your private or public repo in github or bitbucket. That way you can have all programs practised at one place and you can refer to them at any point of time.

Thanks & Regards,

Suryanarayana Murthy Maganti.

Namith Kumar wrote:Thanks Vivz Sharma. Great point about summarizing a chapter.

Vivz Sharma wrote:Namith, I still go old school way of writing down the key points into a book chapter wise of course and at the end you have a summary from the book to check whether you missed out on any point or no. One important thing I want to say is for some it many be easy point to memorize and for you it is not then try to challenge yourself that you haven't forgotten any key points from previous chapters.
Happy Learning

Campbell Ritchie wrote:Does that mean you sent that information to Oracle/PearsonVue?

Hi Campbell, the issue is resolved by Oracle team.

Thanks & Regards,

Surya Maganti.

Mikalai Zaikin wrote:Hi Surya,

Out of curiosity, did you manage to apply the promo code ?


Hi Zaikin,

I got the issue resolved from Oracle team. They have sent me the voucher code.

Thanks & Regards,

Surya Maganti.
Hi All,

I purchased OCP cerification voucher from and i have the order id. How should i use it in PearsonVue.

Thanks & Regards,

Hi All,

I am trying to get 50% off on Certification but always the payment section is having an issue from Oracle site. Is  there any option other than oracle site to pay like Pearson. The issue is observed whenever credit card details are entered and clicked on Pay button.

Please find the attachment. I tried three times on different days but all the times the issue is the same. I reached to customer care but havenot got proper response, like they are asking me to reapply it. Is there anyone facing this issue ? Any other alternatives please.

Thanks & Regards,

I can able to return the collection of messages in the service class. But the problem is that i want to set those messages to Object as it should be passed to VO.

7 years ago
Hi, I am using drools i.e., a fire engine. Instead of writing the business logic in java i am using text based rules. Everything is fine but i have doubt how to assign the error messages or warning messages to the corresponding object which i am inserting in session. I want to set the error messages to the pojo class so that in UI i can display it. Please find the code below.

SecurityRules.drl File

ServiceImplementation class. The problem is here. I am not understanding how to set error messages to UserLogin Pojo class. I have written one logic please correct me. I think what i have written is not setting the error messages to pojo class.

the code is working fine. I am getting the errors also and i am uning the condition that if the size of errors > 0 dont call save or update method. Upto here no problem. The problem is how to set the error message to pojo class so that in UI i can display it.
7 years ago
Thanks Jeff. I will try first and if turns out wrong, i will seek your help.

7 years ago
Hi, I have one list as List<Message> messages=new ArrayList<Message>, where Message is a class which has four properties like, string msg, string shortlist, integer severtity, string errormsg

String msg;
Stirng shortlist;
integer severity;
String errormsg;}

One more class is Messages. java

Where i have declared List<Message> messages=new ArrayList<Message>.

For this getter and setters are written

I have a method in as

addList(String msg, String shortlist, integer severity, String errormsg)
Message m=new Message(String msg, String shortlist, integer severity, String errormsg)

One more method called as
int severity;

// How to get max value from messages list ?. I am not getting solution here. List<Message> messages contains 3 numbers as severity i.e, assume 3, 5, 4. I have to use for each or iterator and find the max value ? How its done ?

return severity;

My question is how to get all the severities in the getSevertiy() from messages (which is a list) and find the max value ?

7 years ago

Why i am getting output for s2 as "with generics" instead of object. What i assume is that return type of get is Object without generics and so we have assigned Object s2=stringList1.get(1) but why i am getting "with generics" whereas i have to get an object as value in System.out.println(s2);
7 years ago
Thanks Jesper.
7 years ago
Hi, I had one doubt regarding the block which is there in the code. When i remove the block i am getting errors. Why the blocks are used here? I am having doubt regarding it. The block is { states.add("VA"P) ........}
7 years ago
Ya What john told is right. What you told is also right as you can use try-catch method or throws clause. Any questions or suggestions or improvements are always welcome
7 years ago

Runtime Exceptions are called as Unchecked Exceptions. Error and its subclasses also throw Unchecked Exceptions.

NullPointerException is an unchecked Runtime Exception. OutOfMemory is Error Unchecked Exception.

Example of NullPointer Exception:

String s;
System.out.prinlnt(s.toUpperCase()) will throw null pointer Exception as s is not assigned to any object and it contains null and we are trying to print s.toUpperCase() and it compiles but fails at runtime.

If still any queries regarding exceptions let me know.
7 years ago