{"id":27,"date":"2008-06-24T14:13:27","date_gmt":"2008-06-24T07:13:27","guid":{"rendered":"http:\/\/www.icez.net\/blog\/?p=27"},"modified":"2008-07-21T03:40:21","modified_gmt":"2008-07-20T20:40:21","slug":"collection-framework","status":"publish","type":"post","link":"https:\/\/www.icez.net\/blog\/27\/collection-framework","title":{"rendered":"0023 | Collections Framework"},"content":{"rendered":"<p>\u0e44\u0e21\u0e48\u0e21\u0e35\u0e2d\u0e30\u0e44\u0e23\u0e04\u0e23\u0e31\u0e1a \u0e40\u0e2d\u0e32 code \u0e21\u0e32\u0e40\u0e01\u0e47\u0e1a\u0e44\u0e27\u0e49\u0e40\u0e09\u0e22\u0e46 555<br \/>\n\u0e01\u0e25\u0e31\u0e1a\u0e21\u0e32\u0e2d\u0e48\u0e32\u0e19\u0e2d\u0e35\u0e01\u0e17\u0e35\u0e04\u0e07\u0e25\u0e37\u0e21\u0e41\u0e25\u0e49\u0e27\u0e41\u0e2b\u0e07\u0e46 \u0e27\u0e48\u0e32\u0e21\u0e31\u0e19\u0e44\u0e27\u0e49\u0e17\u0e33\u0e2d\u0e30\u0e44\u0e23<\/p>\n<blockquote>\n<pre lang=\"java\" line=\"1\">import java.util.*;\r\nclass Product implements Comparable<Product>\r\n{\r\npublic int id;\r\npublic String name;\r\npublic int qty;\r\npublic double price;\r\n\r\npublic Product(int id, String name, int qty, double price) {\r\nthis.id = id;\r\nthis.name = name;\r\nthis.qty = qty;\r\nthis.price = price;\r\n}\r\n\r\npublic String toString() {\r\nreturn this.id + \u201d : \u201d + this.name + \u201d : \u201c + this.qty + \u201d : \u201c + this.price;\r\n}\r\n\r\npublic int compareTo(Product s) {\r\nreturn s.qty - this.qty;\r\n}\r\n}<\/pre>\n<\/blockquote>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<blockquote>\n<pre lang=\"java\" line=\"1\">import java.util.*;\r\nclass ProductDB\r\n{\r\npublic static void main(String[] args)\r\n{\r\nList<Product> db = new LinkedList<Product>();\r\ndb.add(new Product(1, \u201cpen\u201d, 20, 5.50d));\r\ndb.add(new Product(2, \u201cruler\u201d, 18, 10.00d));\r\ndb.add(new Product(3, \u201cnotebook\u201d, 15, 18.50d));\r\ndb.add(new Product(4, \u201crubber\u201d, 40, 15.00d));\r\ndb.add(new Product(5, \u201cpencil\u201d, 25, 3.00d));\r\nCollections.sort(db);\r\nfor (Product i : db) {\r\nSystem.out.println(i);\r\n}\r\n}\r\n}<\/pre>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u0e44\u0e21\u0e48\u0e21\u0e35\u0e2d\u0e30\u0e44\u0e23\u0e04\u0e23\u0e31\u0e1a \u0e40\u0e2d\u0e32 code \u0e21\u0e32\u0e40\u0e01\u0e47\u0e1a\u0e44\u0e27\u0e49\u0e40\u0e09\u0e22\u0e46 555 \u0e01\u0e25\u0e31\u0e1a\u0e21\u0e32\u0e2d\u0e48\u0e32\u0e19\u0e2d\u0e35\u0e01\u0e17\u0e35\u0e04\u0e07\u0e25\u0e37\u0e21\u0e41\u0e25\u0e49\u0e27\u0e41\u0e2b\u0e07\u0e46 \u0e27\u0e48\u0e32\u0e21\u0e31\u0e19\u0e44\u0e27\u0e49\u0e17\u0e33\u0e2d\u0e30\u0e44\u0e23 import java.util.*; class Product implements Comparable { public int id; public String name; public int qty; public double price; public Product(int id, String name, int qty, double price) { this.id = id; this.name = name; this.qty = qty; this.price = price; } public String toString() { return this.id [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44],"tags":[45,46,47],"class_list":["post-27","post","type-post","status-publish","format-standard","hentry","category-java","tag-collection","tag-list","tag-sorting"],"_links":{"self":[{"href":"https:\/\/www.icez.net\/blog\/wp-json\/wp\/v2\/posts\/27","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.icez.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.icez.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.icez.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.icez.net\/blog\/wp-json\/wp\/v2\/comments?post=27"}],"version-history":[{"count":0,"href":"https:\/\/www.icez.net\/blog\/wp-json\/wp\/v2\/posts\/27\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.icez.net\/blog\/wp-json\/wp\/v2\/media?parent=27"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.icez.net\/blog\/wp-json\/wp\/v2\/categories?post=27"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.icez.net\/blog\/wp-json\/wp\/v2\/tags?post=27"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}