Advertisement
kijato

Hash of ... ( Integer & Array of Integer )

Jun 12th, 2019
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.21 KB | None | 0 0
  1. //package geometry;
  2.  
  3. // javac Geometry.java && java Geometry
  4.  
  5. import java.util.*;
  6.  
  7. class Point {
  8.     public double id = 0;
  9.     public double y = 0;
  10.     public double x = 0;
  11.     public double m = 0;
  12.     public int srid = 0;
  13.     public void Point(double y, double x, double m) {
  14.         this.y=y;
  15.         this.x=x;
  16.         this.m=m;
  17.     }
  18. }
  19. /*
  20. class LineString {
  21.     public Map<Integer, ArrayList<Point>> line = new HashMap<Integer, ArrayList<Point>>();
  22. }
  23. class Polygon {
  24.     public Map<Integer, LineString> polygon = new HashMap<Integer, LineString>();
  25. }
  26. class MultiPolygon {
  27.     public Map<Integer, Polygon> multipolygon = new HashMap<Integer, Polygon>();
  28. }
  29. */
  30.  
  31. class Geometry {
  32.  
  33.     Map<Integer, HashMap<Integer, HashMap<Integer, ArrayList<Integer> > > > multipolygons =
  34.    new HashMap<Integer, HashMap<Integer, HashMap<Integer, ArrayList<Integer> > > >();
  35.  
  36.     public static void main(String[] args) {
  37.         System.out.println("Hello World!");
  38.        
  39.         Point p = new Point();
  40.         p.y=100;p.x=100;
  41.         System.out.println(p.toString()+": "+p.y+", "+p.x+", "+p.m);
  42.  
  43.         //multipolygons.put(1, new HashMap<2, new HashMap<3, new ArrayList<Integer> > > >();
  44.         //multipolygons.get(1, new HashMap<Integer, HashMap<Integer, ArrayList<Integer> > > );
  45.        
  46.         //2, new HashMap(3, new ArrayList<Intgeger>(Arrays.asList(10, 20, 30)) ) ) );
  47.         //System.out.println(multipolygons.toString());
  48.  
  49.         List<List<Integer>> marks = new ArrayList<>();
  50.         marks.add(new ArrayList<Integer>( Arrays.asList(10, 20, 30) ));
  51.         marks.add(new ArrayList<Integer>( Arrays.asList(11, 22, 33) ));
  52.         System.out.println(marks.toString());
  53.  
  54.         HashMap<String,ArrayList<Integer>> map = new HashMap<String,ArrayList<Integer>>();
  55.         map.put("mango", new ArrayList<Integer>()); map.get("mango").add(4); map.get("mango").add(44);
  56.         map.put("maMgo", new ArrayList<Integer>()); map.get("maMgo").add(45345); map.get("maMgo").add(5345); map.get("maMgo").add(34543);
  57.         System.out.println(map.toString());
  58.  
  59.         HashMap< Integer, HashMap< Integer, ArrayList< Integer > > > map2 = new HashMap< Integer, HashMap< Integer, ArrayList< Integer > > >();
  60.         map2.put(2, new HashMap< Integer, ArrayList< Integer > >() );
  61.         map2.get(2).put(20, new ArrayList< Integer >() );
  62.         map2.get(2).get(20).add(22); map2.get(2).get(20).add(23);
  63.         System.out.println(map2.keySet() +" "+map2.toString());
  64.  
  65.         // Hash of ( Integer & ( Hash of ( Integer & ( Hash of ( Integer & ( Hash of ( Integer & Array of Integer ) ) ) ) ) ) )
  66.         HashMap< Integer, HashMap< Integer, HashMap< Integer, ArrayList< Integer > > > > map3 =
  67.                                     new HashMap< Integer, HashMap< Integer, HashMap< Integer, ArrayList< Integer > > > >();
  68.         map3.put(3,                                   new HashMap< Integer, HashMap< Integer, ArrayList< Integer > > >() );
  69.         map3.get(3).put(20,                                             new HashMap< Integer, ArrayList< Integer > >() );
  70.         map3.get(3).get(20).put(33, new ArrayList< Integer >() );
  71.         map3.get(3).get(20).get(33).add(41);
  72.         map3.get(3).get(20).get(33).add(42);
  73.         map3.get(3).get(20).get(33).add(43);
  74.         System.out.println(map3.toString());
  75.  
  76.         //
  77.  
  78.     }
  79. }
  80.  
  81. /*
  82. RESULT:
  83.  
  84. q:>javac Geometry.java && java Geometry
  85. Hello World!
  86. Point@15db9742: 100.0, 100.0, 0.0
  87. [[10, 20, 30], [11, 22, 33]]
  88. {maMgo=[45345, 5345, 34543], mango=[4, 44]}
  89. [2] {2={20=[22, 23]}}
  90. {3={20={33=[41, 42, 43]}}}
  91.  
  92. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement