Please enable JavaScript.
Coggle requires JavaScript to display documents.
JAVA (Interfaces (Use Interfaces where possible to be your code more…
JAVA
Interfaces
Name start with I, not need nowadays, i.e. InteliJIdea highlight interfaces
-
-
Use Interfaces where possible to be your code more versatile. For example: instead of ArrayList use List
-
-
Inner Classes
-
Creating of non-static inner class (not often, better make inner class private): OuterClass outerInstance = new OuterClass; OuterClass.InnerClass instance = OuterInstance.new InnerClass();
-
anonymous class - like local without name, for listeners for example PROJECT: ListenerExample
-
Collection Framework
Shallow copy - i.e. two ArrayList with same list of objects, references to same objects
methods: sort, min, max, reverse, swap, binarySearch
-
-
Relations Is a, Has a, Can. Not universal
-
-
-
Generics
-
-
if objects of collection implements comparable collection can be sort by sort function from Collection class
-
Abstract Classes
-
abstract, methods to be implemented by inheritance starts with abstract
Immutable Classes
Be careful and don't pass reference to object but new object
Map<String, String> mapa= mapaZVolani (z parametru volani)
LEPE: Map<String, String> mapa = new Map<> mapaZVolani
-
-
-
Set vs List
-
If using your own objects as keys and values in HashMaps a Sets you should implement equals and hashCode methods
-
Bulk operaatins (union, intersect] on sets are destructive. Need to create new objectt
Put into list override the same key value, in set it not override the old value
-
-