Method of organizing data
Paradigm: An approach or method to be followed for writing software.
Imperative Paradigm: Sequence of events based off of a choice. Think about it like a flowchart.
Object-oriented Paradigm: Paradigm that relies on the concept of classes and objects. Think about it like a UML diagram.
Arrays/Lists
public static Animal[] animalData() {
return new Animal[]{
new Animal("Lion", 8, "Gold"),
new Animal("Pig", 3, "Pink"),
new Animal("Robin", 7, "Red"),
new Animal("Cat", 10, "Black"),
new Animal("Kitty", 1, "Calico"),
new Animal("Dog", 14, "Brown")
};
}
//this is a comment
Java HashMap
private final Map<String, Integer> OPERATORS = new HashMap<>();
{
// Map<"token", precedence>
OPERATORS.put("*", 3);
OPERATORS.put("/", 3);
OPERATORS.put("%", 3);
OPERATORS.put("+", 4);
OPERATORS.put("-", 4);
}
Algorithms always accompany data structures.
Replit | Review Ticket |
---|---|
Replit | Review Ticket |