Skip to content
Advertisement

Tag: collections

Unable to decide Java collection

My usecase is like in which I need to maintain a collection of unique items. I may need to frequently add or remove items from the collection at an index(which I have as member of the item currently, but I am open to modification), and while doing that I need to update index of items. I am not able to

Spring SPEL collection projection

A simple question on SPEL collection selection. Look at section 10.5.17 Collection Selection on this page https://docs.spring.io/spring/docs/4.3.10.RELEASE/spring-framework-reference/html/expressions.html What i need is the selection ‘Serbian’ to come from outside and not be a fixed hard coded String. Just for arguments sake consider that, we could get it as “selectedNationality” from the same society class from the same page in the link.

Java 8 Remove 1 List from Other

I have two list of different Objects. I want to remove the list of School objects from List of World objects based on schoolName and location. I cannot use equals and hashCode methods on those two fields as it is creating some other problem. Please help me how it can be done using streams. Answer You can use filter:

Sort List of Strings by Characters In Java

I am trying to write a program to order a list of strings by most least frequent characters within the list. For example, if the list was [apple, orange, banana] the letter frequency within the list would be a – 5, n – 3, p – 2, e – 2, l- 1, o – 1, r – 1, g –

JUnit: assert collection contains an element with a certain property

I want to assert (using JUnit and not any other dependencies like hamcrest) if a collection contains an element with a certain property value). I found this question How do I assert an Iterable contains elements with a certain property? using harmcrest. One option is to override the equals method to check only the property that I want to compare,

Advertisement