-
-
Save uncoded-ro/8c2f74245c6fbdd7d310ed95508cb6ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ro.virtualcampus.app; | |
import java.util.TreeMap; | |
import java.util.Map.Entry; | |
import ro.virtualcampus.ecom.Produs; | |
public class AppTreeMap { | |
public static void main(String[] args) { | |
TreeMap<Integer, Produs> db = new TreeMap<Integer, Produs>(); | |
db.put(1000, new Produs("Monitor", 350.00)); | |
db.put(1011, new Produs("Procesor", 200.23)); | |
db.put(1102, new Produs("Placa de baza", 320.3)); | |
db.put(2023, new Produs("Mouse", 10.5)); | |
db.put(2034, new Produs("Tastatura", 19.99)); | |
System.out.println(db); | |
for(Entry<Integer, Produs> produs: db.entrySet()) | |
System.out.println(produs.getKey() + " " + produs.getValue()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment