Skip to content
Advertisement

Tag: list

Jackson read json in generic List

I’m using Jackson in order to read json messages. One of the values that I’ trying to parse is a List and another value contains the type of the data in the list. This is the structure i ‘ve created in java. Through Class.forName(); I can get the class which represents the data in the list. The question is how

Why no tail() or head() method in List to get last or first element?

I recently had a discussion with a collegue why the List interface in Java doesn’t have a head() and tail() method. In order to implement such a functionality would have to write a wrapper that looked something like this: I’m not aware of all List implementations but I assume that at least in LinkedList and ArrayList it should be pretty

Advertisement