Skip to content

Tag: list

Get element value from a POJO List

I have the following POJO. And I create new indexes in the POJO my adding it. How can I have access to any index element once created? How I would be able to access the 3rd element from 3rd row? Answer First go to the 3rd element, then go the specific field that you want to access. in this case.

error: no suitable method found for newArrayList(String)

I am fairly new to Java and trying to use a Google Cloud service. When I am trying to use an explicit way to point my service account following this guide from this; https://cloud.google.com/docs/authentication/production#passing_code I already have installed requirements. However, this code throws an error a…

how to call class parameter inside the for loop?

Problem:Cannot call the class parameter inside the for loop statement Implementation:I need to call this class inorder my rest api list will function and will show all the data. Problem:Cannot call the class parameter inside the for loop statement Implementation:I need to call this class inorder my rest api l…

How to put multiple values into a json in java

I’m trying to return a list of values from JDBC but multiple columns of the database to solve this I just made a JSON object to make something like this The issue is im getting this error WARN 43953 — [nio-1900-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.Ht…

Dynamic return type based on input argument type

I’m trying to write a small function that takes two lists and sorts one based on the elements of the other. So something like: would result in a sorted list [E, C, A, D, B]. However, valuesToSort might be a list of something different, like integers, floats or other lists. Ideally, I would want my progr…