I have a problem with some Java coding. I saw this coding while I’m studying Java and cannot understand it…
Below are some examples:
public class interface Set<E>
public class SocreManager extends ValueSortedMap<String,Integer>
The things that i cannot understand is the things inside the <> (in this example E and String,Integer )
What this <> mean?
I Googled and I still cannot find a answer.
ClassA<ClassB>Stands forClassAthat is using generics – one of java featurespublic class interface Setthis means that
Setwill be somewhat related to some other type (E). Set is holder for some objects. If you declare it asSet<String>you can put there only Strings, or something casted to String. That’s the use of<E>here.public class SocreManager extends ValueSortedMapSocreManager is wrapper for
ValueSortedMapit can add some new methods toValueSortedMapbut it also can add noting to it, and be used only as class name beautifier. If you add none features to SocreManager, than you will have everything the same as inValueSortedMapbut with shorter and simpler name –SocreManager. But looking at this name tells me that I will contain something more then just methods from super class.