Home » Tag Archives: Collections (page 3)

Tag Archives: Collections

Five useful ways to sorting in java

java-logo

A rapid overview of java sorting :                     normal sort of list : private static List VEGETABLES = Arrays.asList("apple", "cocumbers", "blackberry"); Collections.sort(VEGETABLES); output: apple, blackberry, cocumbers Reverse sorting: private static List VEGETABLES = Arrays.asList("apple", "cocumbers", "blackberry"); Collections.sort(VEGETABLES, Collections.reverseOrder()); output: cocumbers, blackberry, apple with custom comparator: private class StringComparator implements Comparator { ...

Read More »

Array, list, set, map, tuple, record literals in Java

java-logo

Occasionally, when I’m thrilled by the power and expressiveness of JavaScript, I find myself missing one or two features in the Java world. Apart from lambda expressions / closures or whatever you want to call “anonymous functions”, it’s the use of advanced literals for common data types, such as arrays, lists, sets, maps, etc. In JavaScript, no one would think ...

Read More »

Common and Unique Elements In Multiple Collections

apache-commons-logo

This week, we’ll take a break from higher level problems and technology posts to deal with just a little code problem that a lot of us have probably faced. It’s nothing fancy or too hard, but it may save one of you 15 minutes someday, and occasionally it’s nice to get back to basics. So let’s get down to it. ...

Read More »

Avoid Lazy JPA Collections

jboss-hibernate-logo

Hibernate (and actually JPA) has collection mappings: @OneToMany, @ManyToMany, @ElementCollection. All of these are by default lazy. This means the collections are specific implementations of the List or Set interface that hold a reference to the persistent session and the values are loaded from the database only if the collection is accessed. That saves unnecessary database queries if you only ...

Read More »

Java Best Practices – Queue battle and the Linked ConcurrentHashMap

java-logo

Continuing our series of articles concerning proposed practices while working with the Java programming language, we are going to perform a performance comparison between four popular Queue implementation classes with relevant semantics. To make things more realistic we are going to test against a multi–threading environment so as to discuss and demonstrate how to utilize ArrayBlockingQueue, ConcurrentLinkedQueue, LinkedBlockingQueue and/or LinkedList ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close