Skip to content
Advertisement

Tag: collections

How to convert String into Hashmap in java

How can I convert a String into a HashMap? into Where the keys are first_name, last_name and gender and the values are naresh, kumar, male. Note: Keys can be any thing like city = hyderabad. I am looking for a generic approach. Answer This is one solution. If you want to make it more generic, you can use the StringUtils

Java collections faster than c++ containers?

I was reading the comments on this answer and I saw this quote. Object instantiation and object-oriented features are blazing fast to use (faster than C++ in many cases) because they’re designed in from the beginning. and Collections are fast. Standard Java beats standard C/C++ in this area, even for most optimized C code. One user (with really high rep

How to copy a java.util.List into another java.util.List

I have a List<SomeBean> that is populated from a Web Service. I want to copy/clone the contents of that list into an empty list of the same type. A Google search for copying a list suggested me to use Collections.copy() method. In all the examples I saw, the destination list was supposed to contain the exact number of items for

Advertisement