Psvxe Posted July 5, 2015 Share Posted July 5, 2015 So, I've tried many things. Like creating a PriorityQueue but that didn't work out well. Also a heard a few things about a TreeMap but how does that work? Stackoverflow didn't really make me understand the aspect. This is my HashMap HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();With those keys|value 2 227 6 201339 8 200055 10 228771 12 100000 30 997 36 99 43 79 66 451 68 263 70 1207 72 800 91 79 95 88 97 534 99 6290 101 905 103 2025 105 2580 107 1791 109 1946 113 467 115 313 117 500 127 501 129 252 133 340 135 229 139 5994 141 3795 143 1920 145 584 147 511 149 317 157 3720 159 3027 161 1332 163 2460 165 1546 167 1405 169 2453 171 1854 173 750 175 665 177 1001 179 143 181 1521 183 1125 185 316 189 3784 197 5000 205 363 207 5851 209 672 211 1792 213 2331 215 1360 217 1639 219 7021 225 1521 233 289 235 673 237 548 239 1062 243 410 245 1205 247 750 255 429 257 5905 259 879 261 1857 263 2397 265 1644 267 1579 269 7955 272 186 288 260 301 177 303 181 305 825 307 6250 309 232 319 160 329 77 331 72 341 259 353 210 361 77 363 150 365 935 371 354 373 383 377 204 379 221 383 722 385 912 389 6000 391 20000 397 5001 405 778 411 70 413 621 434 206 442 161 444 299 447 396 449 1143 451 11864 453 163 464 664 530 316 532 311 534 921 536 2584 542 1219 544 556 546 2041 548 1773 560 219 561 241 562 102 563 182 564 132 565 392 566 179 569 1676 571 1525 573 1362 575 1241 577 4581 579 371 581 3333 626 823 628 1250 630 624 632 521 640 1625 642 965 646 100 648 488 650 1500 654 1799 656 938 658 679 660 300 662 123 753 83 805 297 809 114 810 193 811 1024 816 186 817 910 819 240 821 72 822 121 823 222 830 147 837 357 847 100 849 81 851 291 853 209 855 686 857 400 859 1440 861 1074 865 94 866 186 867 406 868 1534 869 103 890 73 892 161 893 300 946 73 952 316 954 294 960 184 962 82098 970 231 973 951 975 614 981 11320 983 449 985 19548 987 6480 989 27846 991 2175 993 25501 1005 287 1007 96 1009 110 1011 1675 1013 274 1015 102 1017 147 1019 262 1021 376 1023 490 1027 490 1029 2000 1033 4044 1035 4603 1038 38624 1040 32125 1042 138549 1044 36109 1046 35825 1048 47789 1050 22801 1053 25767 1055 26841 1057 31910 1065 1313 1067 198 1069 523 1071 1636 1073 3652 1077 3709 1079 38746 1083 506 1085 1715 1089 1208 1091 6398 1093 40037 1097 1178 1099 2221 1101 213 1105 282 1109 536 1113 29008 1115 166 1119 993 1121 3093 1123 9690 1125 4466 1127 44408 1133 349 1135 4425 1143 439 1145 1357 1147 11326 1149 60605 1151 93 1153 213 1157 266 1159 1552 1161 1964 1163 20895 1165 1153 1171 123 1177 283 1179 500 1181 777 1183 2171 1185 24432 1187 364818 1191 257 1193 347 1195 1868 1197 1213 1199 3246 1201 34221 1205 73 1209 95 1211 280 1213 4713 1215 19787 1229 12286 1231 19903 1237 715 1239 350 1241 1000 1243 499 1245 900 1247 12933 1249 110413 1267 215 1269 1678 1271 2197 1273 2097 1275 19306 1279 345 1283 255 1285 331 1287 966 1289 12480 1295 388 1297 378 1299 600 1301 1675 1303 18688 1305 65589 1309 81 1311 423 1313 1017 1315 3619 1317 3557 1319 40494 1325 78 1327 2677 1329 533 1331 4536 1333 16530 1339 281 1341 395 1345 2191 1347 18969 1355 151 1357 1091 1359 7466 1361 1497 1365 201 1367 500 1371 2208 1373 24572 1377 140497 1379 269 1381 1638 1383 1513 1385 1873 1387 746 1389 301 1391 8142 1393 9486 1395 9348 1397 9120 1399 9102 1401 26358 1403 26276 1405 26361 1407 26242 1428 100 1430 680 1432 8650 1434 32947 1440 123 1442 2544 1444 140 1446 370 1448 73 1452 213 1456 141 1462 310 1470 2245 1472 1685 1474 1575 1476 1716 1478 2400 1513 1130 1515 405 1523 743 1540 242 1573 238 1592 1627 1595 353 1597 1756 1601 2078 1603 1072 1605 1262 1607 1051 1609 114 1611 466 1613 397 1615 20975 1617 3197 1619 1534 1621 1503 1623 1183 1625 164 1627 184 1629 280 1631 21767 1635 152 1637 1427 1639 1541 1641 1102 1643 1888 1645 18282 1654 203 1656 1366 1658 1950 1660 1225 1662 2145 1664 17381 1673 210 1675 559 1677 1500 1679 1196 1692 86 1694 112 1696 850 1698 1004 1700 2085 1702 22478 1704 22884 1712 23367 1718 681 1722 100 1724 1461 1725 1350 1727 1875 1729 914 1731 2245 1733 122 1737 138 1739 146 1741 196 1743 195 1745 1674 1747 2778 1749 2788 1751 1814 1753 1508 1755 125 1757 120 1761 294 1763 954 1765 895 1767 681 1769 705 1771 678 1773 556 1775 149 1777 99 1781 115 1785 138 1791 265 1793 163 1794 170 1823 110 1833 285 1835 720 1837 158 1891 152 1897 265 1905 416 1909 561 1917 158 1933 149 1935 89 1937 138 1944 83 1949 1420 1951 202 1953 266 1957 121 1959 4166 1961 5837 1963 76 1969 76 1989 11750 2003 246 2007 691 2011 2100 2015 1255 2025 690 2026 319 2028 253 2064 6989 2084 1340 2102 200 2112 255 2114 110 2116 997 2128 326 2136 100 2162 290 2169 333 2217 2782 2229 500 2289 616 2293 989 2297 940 2301 976 2307 500 2309 193 2313 250 2315 731 2325 499 2327 126 2347 76 2349 168 2351 175 2353 525 2355 128 2357 116 2359 1136 2361 2272 2363 13384 2366 134275 2430 206 2432 462 2434 8171 2436 960 2440 4949 2442 3206 2444 3511 2446 1042 2448 1760 2450 6715 2452 669 2454 403 2456 469 2458 103 2460 239 2464 116 2476 14621 2481 1169 2485 1111 2487 1597 2489 2452 2491 2591 2493 2343 2495 2957 2497 4196 2499 5315 2501 7739 2503 7928 2505 1949 2509 2960 2520 250 2522 2312 2550 1834 2552 1871 2568 1084 2570 2191 2572 18419 2577 18191327 2579 518806 2581 2225243 2587 17083 2589 17244 2593 56943 2601 3300 2603 10971 2605 4216 2607 50258 2609 11800 2611 21000 2615 52290 2617 63358 2619 44409 2621 60464 2623 45164 2625 44769 2627 24702 2629 36330 2633 27370 2635 36990 2637 40054 2639 5000 2641 12275 2643 74700 2645 19999 2647 35000 2649 11978 2651 15127 2653 111315 2655 77124 2657 53903 2659 100181 2661 111402 2663 97366 2665 69874 2667 114457 2669 45211 2671 47928 2673 42000 2675 29534 2859 649 2862 90 2865 140 2866 467 2876 1953 2890 2715 2902 741 2904 1212 2906 1918 2908 800 2910 1148 2912 779 2914 7499 2922 838 2930 1004 2932 1342 2934 1666 2940 3197 2942 3174 2970 655 2998 1811 3000 6019 3002 1944 3004 6367 3008 557 3010 401 3016 3129 3018 2284 3020 1123 3024 7866 3026 5397 3028 4067 3030 1770 3032 781 3034 250 3038 305 3040 1451 3042 922 3044 759 3046 273 3049 1783 3051 5912 3053 9188 3105 663 3107 7320 3122 38478 3125 802 3138 186 3140 1888206 3142 832 3144 1125 3183 284 3188 677 3200 12000 3202 42251 3204 167475 3211 400 3216 76 3226 1850 3228 567 3335 1000 3339 2788 3343 5401 3347 75 3351 1050 3363 1611 3365 1766 3367 2699 3379 700 3381 200 3385 26393 3387 28980 3389 24384 3391 3314 3393 10000 3402 110 3420 236 3434 1115 3448 5121 3473 2566 3475 5823 3476 39984 3477 41623 3478 40668 3479 40418 3480 40368 3481 324907 3483 1583170 3488 250000 3749 49383 3751 52087 3753 53275 3755 38439 3765 500 3767 1096 3777 3033 3779 6926 3781 3999 3789 2327 3791 2090 3799 513 3801 4161 3827 6406 3828 7528 3829 12665 3830 9012 3831 1187559 3832 1277197 3833 1164046 3834 917616 3835 44625 3836 37491 3837 50429 3838 41535 3853 1818 4012 975 4014 900 4087 185052 4089 14490 4091 81175 4093 50000 4095 5937 4097 7907 4099 14800 4101 81216 4103 46933 4105 5704 4107 16525 4109 10813 4111 93359 4113 52526 4115 5822 4117 5654 4119 1057 4121 8060 4125 328 4127 750 4129 948 4131 10841 4151 2074017 4153 34490 4156 5794 4164 633 4166 458 4168 697 4170 14884 4207 2003 4212 925000 4224 760870 4300 245 4302 316 4304 2474 4306 616 4308 3546 4310 2182 4315 880 4323 3330 4325 105 4327 1000 4331 677 4333 960 4337 402 4339 500 4345 136 4347 941 4351 699 4353 572 4363 2000 4365 250 4367 750 4369 1950 4371 6901 4373 509 4387 1000 4393 1137 4401 200 4403 2999 4409 2000 4411 1500 4413 323 4417 3684 4440 4000 4456 287 4529 1499 4537 3500 4548 1775 4551 999 4580 100 4585 184250 4587 66733 4591 999 4593 1000 4627 740 4675 70355 4684 1450 4687 169 4698 133 4708 41103 4710 57355 4712 460645 4714 463504 4716 260829 4718 324768 4720 690535 4722 480793 4724 5148659 4726 8892852 4728 236962 4730 291238 4732 26956 4734 197156 4736 1294697 4738 127891 4740 87 4745 85825 4747 107044 4749 294777 4751 325334 4753 635137 4755 112856 4757 226214 4759 1186321 4812 507 4821 103 4823 99 4827 2383 4834 12908 4842 1042 4850 1005 4860 4228 4872 365100 4878 380050 4884 215007 4890 246007 4896 551007 4902 406355 4938 115000 4944 1117000 4956 67003 4968 184101 4974 250009 4980 500000 4986 99003 4998 937501 5001 1424 5016 307 5018 2633 5028 2930 5042 4999 5044 5000 5046 4500 5100 723 5106 1149 5280 210 5286 460 5287 3847 5288 5596 5289 25764 5290 219 5293 479 5295 19933 5296 74 5298 866 5299 1707 5300 23473 5301 600 5302 191 5303 1136 5304 34951 5312 175 5313 9151 5314 42278 5315 64741 5316 73214 5320 212 5321 845 5323 305 5325 879 5329 899 5331 250 5341 139 5343 200 5354 90 5370 788 5371 9317 5372 43193 5373 71495 5374 76996 5376 252 5386 697 5396 399 5406 474 5416 799 5418 99 5438 879 5458 725 5478 610 5497 699 5499 1500 5500 4383 5501 7480 5502 27990 5503 1191 5516 8500 5521 2268 5531 100 5541 90 5543 250 5547 5000 5574 2411 5575 5584 5576 4964 5621 393 5627 1099 5667 1762 5678 4548 5680 19607 5692 15000 5698 27069 5730 109536 5743 95000 5747 12202 5751 3808 5755 7387 5757 84880 5933 1180 5937 813 5940 5783 5943 557 5952 496 5954 800 5956 150 5968 539 5970 205 5972 1274 5974 901 5986 287 5988 440 6008 1500 6016 3833 6018 1712 6032 221 6034 758 6036 557 6038 157 6043 80 6129 42235 6130 46494 6133 2268 6135 1500 6139 30244 6141 24003 6215 38052 6237 16500 6259 15658 6287 104 6313 2000 6317 25043 6319 416 6322 925 6324 464 6326 99 6328 181 6330 178 6332 75 6335 15864 6337 12404 6339 6714 6345 13898 6349 23594 6351 17255 6357 1499 6367 1900 6377 8000 6382 2993 6388 718 6390 1607 6392 1570 6402 15761 6416 1800 6418 20000 6522 1051 6523 173333 6524 173764 6528 193825 6562 117569 6563 163781 6568 387843 6571 2986105 6585 2984111 6609 500 6617 5147 6619 4998 6623 2650 6625 1900 6629 3716 6631 8548 6685 4997 6687 3662 6689 2523 6691 920 6693 2931 6697 71 6701 220 6703 549 6705 610 6724 123825 6729 7771 6731 259918 6733 3372024 6735 317049 6737 3237060 6739 244148 6760 21652 6809 42138 6812 2565 6814 777 6889 6547654 6914 3884738 6916 4407006 6918 4288319 6920 1467448 6924 5240000 6962 94 6981 100 6983 466 7051 707 7054 350 7060 1983 7122 4999 7124 2000 7132 9700 7134 5000 7158 166465 7159 500 7178 469 7196 1880 7198 2291 7208 6873 7218 2056 7225 249 7319 2651 7323 7832 7327 16208 7334 2957 7336 53000 7340 3039 7342 30614 7348 31650 7358 2700 7362 21850 7370 4521 7372 6001 7374 5380 7378 117197 7380 20709 7382 13097 7384 5007 7386 60000 7388 21220 7390 466525 7392 79999 7394 136200 7396 77481 7398 71593 7399 82683 7400 21898 7416 3958 7418 3227 7650 1517 7668 7030 7919 200 7944 529 7946 631 8007 627 8008 832 8009 598 8010 738 8011 793 8012 1960 8013 703 8015 1094 8423 10300 8429 29500 8778 418 8780 670 8782 1348 8784 136506 8786 329978 8790 1325 8792 5000 8794 257 8872 2884 8878 9038 8880 3878 8901 680390 8921 695835 8928 80000 9028 1145 9038 160 9040 736 9042 115 9044 2837390 9050 2759102 9075 160 9142 105 9143 225 9144 211 9177 100 9179 400 9181 800 9183 2810 9185 10875 9191 100 9192 191 9193 1717 9194 8298 9239 140 9241 298 9242 544 9243 451 9244 1913 9245 8792 9298 550 9305 849 9338 235 9339 329 9340 412 9341 1924 9342 8719 9379 112 9381 339 9419 2196 9431 10012 9438 197 9452 124 9461 1000 9465 9950 9470 560201 9472 55000 9634 3687 9636 10000 9638 8077 9640 10000 9642 10000 9668 23000 9672 7041 9674 12250 9676 9383 9678 4137 9731 24126 9733 1549 9736 129 9739 746 9741 437 9745 103 9845 5999 9851 50000 9856 8999 9861 20000 9864 8999 9867 8999 9998 5500 10008 130 10012 228 10016 1500 10020 1221 10033 625 10034 1268 10039 17500 10041 4000 10043 3486 10045 4025 10069 889 10071 8161 10075 1456 10077 4561 10079 3051 10081 7528 10085 3541 10105 500 10115 112 10127 5501 10148 181 10156 3049 10158 199 10280 3900 10282 811 10286 30468 10288 23858 10290 32490 10292 20080 10294 27119 10296 3084 10298 2537 10302 1678 10306 2072 10322 7602 10330 26040098 10332 29977502 10338 124622500 10340 36199333 10350 16312312 10352 55501236 10354 52028 10362 60300 10364 46133 10366 16207 10368 123305 10370 445639 10372 131057 10374 30903 10376 13333 10378 76858 10380 16365 10382 17610 10384 43939 10386 226378 10388 122116 10390 37392 10394 190000 10398 10809 10400 121202 10402 49998 10406 50000 10414 18056 10416 28815 10420 27014 10422 9999 10426 3289 10434 5451 10438 4147 10440 6661 10442 15333 10446 360580 10448 169785 10450 416397 10452 98092 10454 76219 10456 123078 10458 34997 10462 38080 10464 106675 10466 44531 10468 141390 10470 9782 10472 1763 10474 9622 10476 3413 10496 1525 10564 119753 10589 20010 10810 463 10812 996 10822 200 10824 108 10826 7400 10828 34404 10925 14040 10927 11575 10931 1800 10954 900 10956 898 10958 2676 11037 169683 11065 172 11069 240 11072 561 11076 738 11079 1033 11085 1255 11088 1276 11090 2700 11092 2088 11095 2500 11105 25735 11113 20781 11115 20000 11118 25969 11126 23484 11128 2847443 11133 3130338 11212 1746 11227 1156 11229 2455 11230 3219 11232 3179 11235 1321925 11237 1551 11244 20000 11250 4202 11252 12455 11254 23684 11256 273499 11260 827 11280 164037 11284 17283147 11286 17742301 11335 44294710 11367 670 11433 931 11785 25836394 11787 157390 11789 243920 11791 14008534 11798 540740 11802 54235263 11804 4275398 11806 47489005 11808 3889376 11812 3621420 11818 168000 11820 169000 11822 182203 11824 7563891 11826 794125 11828 13366751 11830 16080598 11832 10550303 11834 22628830 11836 377013 11838 1782033 11840 115763 11889 7750037 11902 44339 11905 1396383 11908 428887 11920 1408950 11924 3722306 11926 5614621 11928 321724 11929 338550 11932 255993 11933 3355500 11934 1399 11936 2099 11943 4148 11951 975 11953 993 11955 1058 11959 2020 11964 69000 11968 23514 11972 22898 11978 25273 11980 22310 11990 44000 11992 1702 11994 275 11998 5931166 12000 6011222 12002 728980 12004 431091 12193 37975 12195 68928 12197 168253 12199 18763 12203 70039 12205 158616 12215 15000 12217 8291 12223 8592 12225 328372 12231 96310 12233 41009 12235 569696 12237 73839 12239 7999 12243 195714 12245 5003 12249 62556 12251 87796 12253 64212 12255 55000 12257 14858 12259 86766 12261 174178 12263 18000 12265 27500 12267 42979 12269 24999 12271 58490 12273 174500 12275 2500 12277 25250 12279 2348 12281 18363 12283 16000 12285 2612 12287 6911 12289 5055 12291 7886 12293 5555 12297 6384 12299 36740 12301 33282 12303 40000 12305 34279 12315 39777 12317 8686 12321 35694 12323 13301 12325 10026 12327 8767 12329 30144 12331 6435 12333 13000 12335 372180 12337 1571420 12341 9080 12347 49998 12351 592848 12355 139800 12357 483671 12361 14540 12363 46000 12365 28000 12369 61512 12371 2956991 12373 172800 12375 42305 12381 25422 12383 1180540 12385 15484 12391 4450000 12393 150000 12395 75000 12397 160000 12399 1963219 12402 6549 12403 689 12404 673 12405 8826 12406 19406 12407 705 12408 1280 12409 6219 12410 2103 12411 1110 12422 239000000 12424 413907812 12432 279995 12439 133333 12441 152889 12443 19483 12447 34166 12451 212092 12455 168283 12460 42083 12462 37158 12464 39710 12466 21021 12468 35585 12470 45500 12472 39325 12474 38205 12476 28944 12478 33500 12482 34875 12486 27200 12488 34868 12490 7004 12492 65111 12494 33962 12496 13167 12498 41682 12500 65227 12502 28250 12504 28000 12506 90092 12508 193491 12510 128012 12512 39800 12514 62123 12518 13153 12520 6794 12522 21635 12526 8008186 12528 49837 12530 20197 12532 44335 12534 113203 12536 412000 12596 7756104 12598 1073411 12601 15240000 12603 0 12605 3358653 12613 6391 12614 2636 12615 1534 12616 2370 12617 177375 12618 386715 12619 244248 12620 260888 12621 72212 12622 73217 12623 60710 12624 63932 12625 5869 12627 4702 12629 2257 12631 1107 12640 837 12642 5455 12695 17005 12697 13886 12699 9638 12701 4491 12757 149999 12763 202547 12769 159810 12771 157500 12775 2920 12776 3500 12777 3288 12778 2496 12779 3436 12783 14515 12786 25915 12789 35000 12798 91000 12800 78880 12802 100000 12817 815000000 12821 32041285 12825 86901866 12829 123452 12831 918268 12833 735000 12849 118757 12851 278500 12863 750823 12865 8881 12867 14488 12869 17202 12871 16567 12873 14723553 12875 2200795 12877 1726841 12879 870958 12881 998547 12883 1666466 12900 1056728 12902 14566015 12905 3873 12907 3413 12911 400 12913 13425 12915 12678 12917 6004 12919 3371 12922 4689334 12924 4745284 12927 583412 12929 515882 12932 548748 12934 167 12936 85005 12938 105 12960 345 12962 2112 12968 348827 12972 1739 12974 1888 12976 603100 12980 1051500 12984 2407 12988 12744 12996 317710 13000 8104 13004 111716 13008 103052 13012 24711 13014 29998 13016 45100 13020 95637 13024 142977 13026 146038 13028 148275 13032 230788 13036 2438844 13038 1000000 13040 404333 13042 490002 13044 372115 13048 204052 13052 163113 13056 213580 13066 9590 13149 49198 13151 4707947 13153 222885 13155 25000 13157 1125000 13159 312806 13163 385500 13171 144094 13173 349004 13175 90272 13190 1641661 (All id's with corresponding value) Quote Link to comment Share on other sites More sharing options...
Mysteryy Posted July 5, 2015 Share Posted July 5, 2015 If you want to sort the keys, make a new list using the keys, then sort it however you want. Using collections would be the easiest way to do it. ArrayList<Integer> keyList = new ArrayList<Integer>(map.keySet()) (Wrote that with no ide so it might not copy and paste) That will make an array list using the map key set. Then you can sort it however. I am not sure if that is the answer you were looking for, but this is not a complicated task. Quote Link to comment Share on other sites More sharing options...
Psvxe Posted July 5, 2015 Author Share Posted July 5, 2015 (edited) If you want to sort the keys, make a new list using the keys, then sort it however you want. Using collections would be the easiest way to do it. ArrayList<Integer> keyList = new ArrayList<Integer>(map.keySet()) (Wrote that with no ide so it might not copy and paste) That will make an array list using the map key set. Then you can sort it however. I am not sure if that is the answer you were looking for, but this is not a complicated task. May I PM you with more details? Edited July 5, 2015 by Psvxe Quote Link to comment Share on other sites More sharing options...
Mysteryy Posted July 5, 2015 Share Posted July 5, 2015 May I PM you with more details? Go for it. Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted July 5, 2015 Share Posted July 5, 2015 You could do something like: ArrayList<Integer> keys = new ArrayList<Integer>(map.keySet()); Collections.sort(keys, Collections.reverseOrder()); //"keys" should now be sorted highest -> lowest Quote Link to comment Share on other sites More sharing options...
Psvxe Posted July 5, 2015 Author Share Posted July 5, 2015 You could do something like: ArrayList<Integer> keys = new ArrayList<Integer>(map.keySet()); Collections.sort(keys, Collections.reverseOrder()); //"keys" should now be sorted highest -> lowest The problem is that I need to get the keys with the lowest or highest value. The key alone is useless. ;p Quote Link to comment Share on other sites More sharing options...
Flamezzz Posted July 5, 2015 Share Posted July 5, 2015 (edited) If you want to keep the keys sorted use a treemap like this: TreeMap<Integer, Integer> map = new TreeMap<>(); map.put(100, 200); map.put(150, 300); map.put(1, 200); map.put(-100, 800); map.put(-50, 8000); map.put(900, 2000); map.put(700, 6000); log("Smallest key: " + map.firstKey() + " -> " + map.get(map.firstKey())); log("Largest key: " + map.lastKey() + " -> " + map.get(map.lastKey())); log("Iterating keys:"); for(int k : map.descendingKeySet()) { log(k); } Edited July 5, 2015 by Flamezzz Quote Link to comment Share on other sites More sharing options...
Mysteryy Posted July 5, 2015 Share Posted July 5, 2015 The problem is that I need to get the keys with the lowest or highest value. The key alone is useless. ;p Did you get it sorted out? You dont need to use a hash map for your situation. Quote Link to comment Share on other sites More sharing options...
Psvxe Posted July 5, 2015 Author Share Posted July 5, 2015 (edited) Did you get it sorted out? You dont need to use a hash map for your situation. Didn't work as I'd want to. If you want to keep the keys sorted use a treemap like this: TreeMap<Integer, Integer> map = new TreeMap<>(); map.put(100, 200); map.put(150, 300); map.put(1, 200); map.put(-100, 800); map.put(-50, 8000); map.put(900, 2000); map.put(700, 6000); log("Smallest key: " + map.firstKey() + " -> " + map.get(map.firstKey())); log("Largest key: " + map.lastKey() + " -> " + map.get(map.lastKey())); log("Iterating keys:"); for(int k : map.descendingKeySet()) { log(k); } This isn't what I'm looking for. Since I need to get the keys sorted on lowest/highest value. rather than lowest/highest key. EDIT: Figured it out. 12603:0 411:70 6697:71 331:72 821:72 890:73 946:73 1205:73 1448:73 5296:74 3347:75 6332:75 1963:76 1969:76 2347:76 3216:76 329:77 361:77 1325:78 43:79 91:79 6043:80 849:81 1309:81 753:83 1944:83 1692:86 4740:87 95:88 1935:89 2862:90 5354:90 5541:90 1151:93 865:94 6962:94 1209:95 1007:96 36:99 1777:99 4823:99 5418:99 6326:99 646:100 847:100 1428:100 1722:100 2136:100 4580:100 5531:100 6981:100 9177:100 9191:100 562:102 1015:102 869:103 2458:103 4821:103 9745:103 6287:104 4325:105 9142:105 12938:105 10824:108 1009:110 1823:110 2114:110 3402:110 1694:112 9379:112 10115:112 809:114 1609:114 1781:115 9042:115 2357:116 2464:116 1757:120 822:121 1957:121 1733:122 662:123 1171:123 1440:123 9452:124 1755:125 2327:126 2355:128 9736:129 10008:130 564:132 4698:133 4345:136 1737:138 1785:138 1937:138 5341:139 1444:140 2865:140 9239:140 1456:141 179:143 1739:146 830:147 1017:147 1775:149 1933:149 363:150 5956:150 1355:151 1635:152 1891:152 6038:157 1837:158 1917:158 319:160 9038:160 9075:160 442:161 892:161 453:163 1793:163 1625:164 1115:166 12934:167 2349:168 4687:169 1794:170 11065:172 2351:175 5312:175 301:177 6330:178 566:179 303:181 6328:181 10148:181 563:182 960:184 1627:184 272:186 816:186 866:186 3138:186 5302:191 9192:191 810:193 2309:193 1743:195 1741:196 9438:197 1067:198 10158:199 2102:200 3381:200 4401:200 5343:200 7919:200 10822:200 1365:201 1951:202 1654:203 377:204 5970:205 434:206 2430:206 853:209 353:210 1673:210 5280:210 9144:211 5320:212 1101:213 1153:213 1452:213 1267:215 560:219 5290:219 6701:220 379:221 6032:221 823:222 9143:225 2:227 10012:228 135:229 970:231 309:232 9338:235 3420:236 1573:238 2460:239 819:240 11069:240 561:241 1540:242 4300:245 2003:246 7225:249 2313:250 2520:250 3034:250 4365:250 5331:250 5543:250 129:252 5376:252 2028:253 1283:255 2112:255 1191:257 8794:257 341:259 288:260 1019:262 68:263 1791:265 1897:265 1157:266 1953:266 1379:269 3046:273 1013:274 11994:275 1211:280 1629:280 1339:281 1105:282 1177:283 3183:284 1833:285 1005:287 4456:287 5986:287 233:289 2162:290 851:291 954:294 1761:294 805:297 9241:298 444:299 660:300 893:300 1389:301 3038:305 5323:305 5016:307 1462:310 532:311 115:313 185:316 530:316 952:316 4302:316 149:317 2026:319 4413:323 2128:326 4125:328 9339:329 1285:331 2169:333 9381:339 133:340 1279:345 12960:345 1193:347 1133:349 1239:350 7054:350 1595:353 371:354 837:357 205:363 1446:370 579:371 1021:376 1297:378 373:383 1295:388 565:392 5621:393 1341:395 447:396 1613:397 5396:399 857:400 3211:400 9179:400 12911:400 3010:401 4337:402 2454:403 1515:405 867:406 243:410 9340:412 1905:416 6319:416 8778:418 1311:423 255:429 9741:437 1143:439 5988:440 983:449 66:451 9243:451 4166:458 5286:460 2432:462 10810:463 6324:464 1611:466 6983:466 113:467 2866:467 2456:469 7178:469 5406:474 5293:479 648:488 1023:490 1027:490 5952:496 1243:499 2325:499 117:500 1179:500 1367:500 2229:500 2307:500 3765:500 4339:500 6609:500 7159:500 10105:500 127:501 1083:506 4812:507 4373:509 147:511 3799:513 632:521 1069:523 2353:525 7944:529 1329:533 97:534 1109:536 5968:539 9242:544 237:548 6703:549 9298:550 544:556 1773:556 3008:557 5943:557 6036:557 1675:559 1909:561 11072:561 3228:567 4353:572 145:584 8009:598 1299:600 5301:600 5478:610 6705:610 975:614 2289:616 4306:616 413:621 630:624 10033:625 8007:627 7946:631 4164:633 2859:649 2970:655 3105:663 464:664 175:665 2452:669 8780:670 11367:670 209:672 235:673 12404:673 3188:677 4331:677 1771:678 658:679 1430:680 1718:681 1767:681 855:686 12403:689 2025:690 2007:691 4168:697 5386:697 4351:699 5497:699 3379:700 8013:703 1769:705 12407:705 7051:707 1237:715 6388:718 1835:720 383:722 5100:723 5458:725 2315:731 9040:736 8010:738 11076:738 4627:740 2902:741 1523:743 1387:746 9739:746 173:750 247:750 4127:750 4367:750 6034:758 3044:759 1181:777 6814:777 405:778 2912:779 3032:781 5370:788 8011:793 5416:799 72:800 2908:800 5954:800 9181:800 3125:802 10282:811 5937:813 626:823 305:825 11260:827 3142:832 8008:832 12640:837 2922:838 5321:845 9305:849 1696:850 5298:866 259:879 5325:879 5438:879 4315:880 10069:889 1765:895 10956:898 5329:899 1245:900 4014:900 10954:900 5974:901 101:905 817:910 385:912 1729:914 6691:920 534:921 3042:922 6322:925 11433:931 365:935 656:938 2297:940 4347:941 4129:948 973:951 1763:954 2436:960 4333:960 642:965 1287:966 4012:975 11951:975 2301:976 2293:989 1119:993 11953:993 10812:996 30:997 2116:997 4551:999 4591:999 1241:1000 3335:1000 4327:1000 4387:1000 4593:1000 9461:1000 177:1001 1698:1004 2930:1004 4850:1005 1313:1017 811:1024 11079:1033 2446:1042 4842:1042 3351:1050 1607:1051 6522:1051 4119:1057 11955:1058 239:1062 1603:1072 861:1074 2568:1084 1357:1091 8015:1094 3767:1096 5627:1099 1641:1102 12631:1107 12411:1110 2485:1111 3434:1115 3020:1123 183:1125 3144:1125 1513:1130 2359:1136 5303:1136 4393:1137 449:1143 9028:1145 2910:1148 5106:1149 1165:1153 11227:1156 2481:1169 1097:1178 5933:1180 1623:1183 5503:1191 1679:1196 245:1205 70:1207 1089:1208 2904:1212 1197:1213 542:1219 10020:1221 1660:1225 575:1241 628:1250 2015:1255 11085:1255 1605:1262 10034:1268 5972:1274 11088:1276 12408:1280 1065:1313 8790:1325 161:1332 2084:1340 2932:1342 8782:1348 1725:1350 1145:1357 215:1360 573:1362 1656:1366 11934:1399 167:1405 1949:1420 5001:1424 1637:1427 859:1440 4684:1450 3040:1451 10075:1456 1724:1461 1361:1497 4529:1499 6357:1499 650:1500 1677:1500 4411:1500 5499:1500 6008:1500 6135:1500 10016:1500 1621:1503 1753:1508 1383:1513 7650:1517 181:1521 225:1521 571:1525 10496:1525 868:1534 1619:1534 12615:1534 1639:1541 165:1546 9733:1549 11237:1551 1159:1552 6392:1570 1474:1575 267:1579 2487:1597 6390:1607 3363:1611 640:1625 1592:1627 1071:1636 1381:1638 217:1639 265:1644 2934:1666 1745:1674 1011:1675 1301:1675 569:1676 1269:1678 10302:1678 1472:1685 11992:1702 5299:1707 6018:1712 1085:1715 1476:1716 9193:1717 12972:1739 11212:1746 1597:1756 2448:1760 5667:1762 10472:1763 3365:1766 3030:1770 548:1773 4548:1775 3049:1783 107:1791 211:1792 654:1799 6416:1800 10931:1800 2998:1811 1751:1814 3853:1818 2550:1834 3226:1850 171:1854 261:1857 1195:1868 2552:1871 1385:1873 1727:1875 7196:1880 1643:1888 12974:1888 6367:1900 6625:1900 9244:1913 2906:1918 143:1920 9341:1924 3002:1944 109:1946 2505:1949 1658:1950 4369:1950 2876:1953 8012:1960 1161:1964 7060:1983 1029:2000 4363:2000 4409:2000 6313:2000 7124:2000 4207:2003 11959:2020 103:2025 546:2041 7218:2056 10306:2072 1601:2078 1700:2085 11092:2088 3791:2090 1273:2097 11936:2099 2011:2100 12410:2103 12962:2112 1662:2145 1183:2171 991:2175 4310:2182 1345:2191 2570:2191 9419:2196 1271:2197 1371:2208 1099:2221 1470:2245 1731:2245 12629:2257 5521:2268 6133:2268 2361:2272 3018:2284 7198:2291 2522:2312 3789:2327 213:2331 2493:2343 12279:2348 12616:2370 4827:2383 263:2397 1478:2400 12984:2407 5574:2411 2489:2452 169:2453 11229:2455 163:2460 4304:2474 12778:2496 11095:2500 12275:2500 6689:2523 10298:2537 1442:2544 6812:2565 3473:2566 105:2580 536:2584 2491:2591 12285:2612 5018:2633 12614:2636 6623:2650 7319:2651 10958:2676 1327:2677 3367:2699 7358:2700 11090:2700 2890:2715 1747:2778 2217:2782 1749:2788 3339:2788 9183:2810 8872:2884 12775:2920 5028:2930 6693:2931 2495:2957 7334:2957 2509:2960 6382:2993 4403:2999 159:3027 3777:3033 7340:3039 10156:3049 10079:3051 10296:3084 1121:3093 3016:3129 2942:3174 11232:3179 1617:3197 2940:3197 2442:3206 11230:3219 7418:3227 1199:3246 12777:3288 10426:3289 2601:3300 3391:3314 4323:3330 581:3333 12919:3371 10476:3413 12907:3413 12779:3436 10043:3486 4537:3500 12776:3500 2444:3511 10085:3541 4308:3546 1317:3557 1315:3619 1073:3652 6687:3662 4417:3684 9634:3687 1077:3709 6629:3716 157:3720 189:3784 141:3795 5751:3808 6016:3833 5287:3847 12905:3873 8880:3878 10280:3900 7416:3958 3781:3999 4440:4000 10041:4000 10045:4025 1033:4044 3028:4067 9678:4137 10438:4147 11943:4148 3801:4161 1959:4166 2497:4196 11250:4202 2605:4216 4860:4228 5500:4383 1135:4425 1125:4466 12701:4491 5046:4500 7370:4521 1331:4536 5678:4548 10077:4561 577:4581 1035:4603 12627:4702 1213:4713 2440:4949 5576:4964 6685:4997 6619:4998 5042:4999 7122:4999 197:5000 2639:5000 5044:5000 5547:5000 7134:5000 8792:5000 397:5001 12245:5003 7384:5007 12289:5055 3448:5121 6617:5147 2499:5315 7374:5380 3026:5397 3343:5401 10434:5451 12642:5455 9998:5500 10127:5501 12293:5555 5575:5584 5288:5596 4117:5654 4105:5704 5940:5783 4156:5794 4115:5822 3475:5823 1961:5837 207:5851 12625:5869 257:5905 3051:5912 4095:5937 139:5994 9845:5999 389:6000 7372:6001 12917:6004 3000:6019 12409:6219 307:6250 99:6290 3004:6367 12297:6384 12613:6391 1091:6398 3827:6406 12331:6435 987:6480 12402:6549 10440:6661 6339:6714 2450:6715 12520:6794 7208:6873 4371:6901 12287:6911 3779:6926 2064:6989 12490:7004 219:7021 7668:7030 9672:7041 3107:7320 5755:7387 10826:7400 1359:7466 5501:7480 2914:7499 3828:7528 10081:7528 10322:7602 2501:7739 6729:7771 7323:7832 3024:7866 12291:7886 4097:7907 2503:7928 269:7955 12239:7999 6377:8000 4121:8060 9638:8077 13000:8104 1391:8142 10071:8161 2434:8171 12217:8291 9194:8298 5516:8500 6631:8548 12223:8592 1432:8650 12317:8686 9342:8719 12327:8767 9245:8792 12405:8826 12865:8881 9856:8999 9864:8999 9867:8999 3830:9012 8878:9038 12341:9080 1399:9102 1397:9120 5313:9151 3053:9188 5371:9317 1395:9348 9676:9383 1393:9486 13066:9590 10474:9622 12699:9638 1123:9690 7132:9700 10470:9782 9465:9950 10422:9999 3393:10000 9636:10000 9640:10000 9642:10000 9431:10012 12325:10026 8423:10300 10398:10809 4109:10813 4131:10841 9185:10875 2603:10971 981:11320 1147:11326 10927:11575 1989:11750 2609:11800 451:11864 2649:11978 3200:12000 5747:12202 9674:12250 2641:12275 1229:12286 6337:12404 11252:12455 1289:12480 3829:12665 12915:12678 12988:12744 4834:12908 1247:12933 12333:13000 7382:13097 12518:13153 12496:13167 12323:13301 10376:13333 2363:13384 12913:13425 12697:13886 6345:13898 10925:14040 12867:14488 4089:14490 12783:14515 12361:14540 2476:14621 4099:14800 12257:14858 4170:14884 5692:15000 12215:15000 2651:15127 10442:15333 12385:15484 6259:15658 6402:15761 6335:15864 12283:16000 10366:16207 7327:16208 10380:16365 6237:16500 4107:16525 1333:16530 12871:16567 12695:17005 2587:17083 12869:17202 2589:17244 6351:17255 1664:17381 10039:17500 10382:17610 12263:18000 10414:18056 1645:18282 12281:18363 2572:18419 1303:18688 12199:18763 1347:18969 1275:19306 12406:19406 12443:19483 985:19548 5680:19607 1215:19787 1231:19903 5295:19933 2645:19999 391:20000 6418:20000 9861:20000 11115:20000 11244:20000 10589:20010 10292:20080 12530:20197 7380:20709 11113:20781 1163:20895 1615:20975 2611:21000 12466:21021 7388:21220 12522:21635 6760:21652 1631:21767 7362:21850 7400:21898 11980:22310 1702:22478 1050:22801 1704:22884 11972:22898 9668:23000 1712:23367 5300:23473 11126:23484 11968:23514 6349:23594 11254:23684 10288:23858 6141:24003 9731:24126 3389:24384 1185:24432 1373:24572 2627:24702 13012:24711 12269:24999 13155:25000 6317:25043 12277:25250 11978:25273 12381:25422 993:25501 11105:25735 5289:25764 1053:25767 12786:25915 11118:25969 1407:26242 1403:26276 1401:26358 1405:26361 3385:26393 1055:26841 4732:26956 10420:27014 5698:27069 10294:27119 12486:27200 2633:27370 12265:27500 989:27846 5502:27990 12365:28000 12504:28000 12502:28250 10416:28815 12476:28944 3387:28980 1113:29008 8429:29500 2675:29534 13014:29998 12329:30144 6139:30244 10286:30468 7342:30614 10374:30903 7348:31650 1057:31910 1040:32125 10290:32490 1434:32947 12301:33282 12478:33500 12494:33962 12447:34166 1201:34221 12305:34279 10828:34404 4153:34490 12488:34868 12482:34875 5304:34951 10458:34997 2647:35000 12789:35000 12468:35585 12321:35694 1046:35825 1044:36109 2629:36330 12299:36740 2635:36990 12462:37158 10390:37392 3836:37491 12193:37975 6215:38052 10462:38080 12474:38205 3755:38439 3122:38478 1038:38624 1079:38746 12472:39325 12464:39710 12315:39777 12512:39800 3476:39984 12303:40000 1093:40037 2637:40054 3480:40368 3479:40418 1319:40494 3478:40668 12233:41009 4708:41103 3838:41535 3477:41623 12498:41682 2673:42000 12460:42083 6809:42138 6129:42235 3202:42251 5314:42278 12375:42305 12267:42979 5372:43193 10384:43939 11990:44000 12532:44335 11902:44339 1127:44408 2619:44409 10466:44531 3835:44625 2625:44769 13016:45100 2623:45164 2669:45211 12470:45500 12363:46000 10364:46133 6130:46494 4103:46933 1048:47789 2671:47928 13149:49198 3749:49383 12528:49837 10402:49998 12347:49998 4093:50000 9851:50000 10406:50000 2607:50258 3837:50429 10354:52028 3751:52087 2615:52290 4113:52526 7336:53000 3753:53275 2657:53903 9472:55000 12255:55000 2593:56943 4710:57355 12271:58490 7386:60000 10362:60300 2621:60464 1149:60605 12623:60710 12369:61512 12514:62123 12249:62556 2617:63358 12624:63932 12253:64212 5315:64741 12492:65111 12500:65227 1305:65589 4587:66733 4956:67003 12195:68928 11964:69000 2665:69874 12203:70039 4675:70355 5373:71495 7398:71593 12621:72212 5316:73214 12622:73217 12237:73839 2643:74700 12395:75000 10454:76219 10378:76858 5374:76996 2655:77124 7396:77481 12800:78880 7392:79999 8928:80000 4091:81175 4101:81216 962:82098 7399:82683 5757:84880 12936:85005 4745:85825 12259:86766 12251:87796 12506:90092 13175:90272 12798:91000 4111:93359 5743:95000 13020:95637 12231:96310 2663:97366 10452:98092 4986:99003 12:100000 12802:100000 2659:100181 13008:103052 10464:106675 4747:107044 5730:109536 1249:110413 2653:111315 2661:111402 13004:111716 4755:112856 12534:113203 2667:114457 4938:115000 11840:115763 7378:117197 6562:117569 12849:118757 10564:119753 10400:121202 10388:122116 10456:123078 10368:123305 12829:123452 6724:123825 4738:127891 12510:128012 10372:131057 12439:133333 2366:134275 7394:136200 8784:136506 1042:138549 12355:139800 1377:140497 10468:141390 13024:142977 13171:144094 13026:146038 13028:148275 12757:149999 12393:150000 12441:152889 11787:157390 12771:157500 12205:158616 12769:159810 12397:160000 13052:163113 6563:163781 11280:164037 7158:166465 3204:167475 11818:168000 12197:168253 12455:168283 11820:169000 11037:169683 10448:169785 12373:172800 6523:173333 6524:173764 12261:174178 12273:174500 12617:177375 11822:182203 4968:184101 4585:184250 4087:185052 10394:190000 12508:193491 6528:193825 12243:195714 4734:197156 8:200055 6:201339 12763:202547 13048:204052 12451:212092 13056:213580 4884:215007 13153:222885 4757:226214 10386:226378 10:228771 13032:230788 4728:236962 11789:243920 6739:244148 12619:244248 4890:246007 3488:250000 4974:250009 11932:255993 6731:259918 4716:260829 12620:260888 11256:273499 12851:278500 12432:279995 4730:291238 4749:294777 13159:312806 6735:317049 12996:317710 11928:321724 4718:324768 3481:324907 4751:325334 12225:328372 8786:329978 11929:338550 12968:348827 13173:349004 10446:360580 1187:364818 4872:365100 13044:372115 12335:372180 11836:377013 4878:380050 13163:385500 12618:386715 6568:387843 13040:404333 4902:406355 12536:412000 10450:416397 11908:428887 12004:431091 10370:445639 4712:460645 4714:463504 7390:466525 4722:480793 12357:483671 13042:490002 4980:500000 12929:515882 2579:518806 11798:540740 12932:548748 4896:551007 9470:560201 12235:569696 12927:583412 12351:592848 12976:603100 4753:635137 8901:680390 4720:690535 8921:695835 12002:728980 12833:735000 12863:750823 4224:760870 11826:794125 12879:870958 3834:917616 12831:918268 4212:925000 4998:937501 12881:998547 13038:1000000 12980:1051500 12900:1056728 12598:1073411 4944:1117000 13157:1125000 3833:1164046 12383:1180540 4759:1186321 3831:1187559 3832:1277197 4736:1294697 11235:1321925 11905:1396383 11920:1408950 6920:1467448 12337:1571420 3483:1583170 13190:1641661 12883:1666466 12877:1726841 11838:1782033 3140:1888206 12399:1963219 4151:2074017 12875:2200795 2581:2225243 13036:2438844 9050:2759102 9044:2837390 11128:2847443 12371:2956991 6585:2984111 6571:2986105 11133:3130338 6737:3237060 11933:3355500 12605:3358653 6733:3372024 11812:3621420 11924:3722306 6914:3884738 11808:3889376 11804:4275398 6918:4288319 6916:4407006 12391:4450000 12922:4689334 13151:4707947 12924:4745284 4724:5148659 6924:5240000 11926:5614621 11998:5931166 12000:6011222 6889:6547654 11824:7563891 11889:7750037 12596:7756104 12526:8008186 4726:8892852 11832:10550303 11828:13366751 11791:14008534 12902:14566015 12873:14723553 12601:15240000 11830:16080598 10350:16312312 11284:17283147 11286:17742301 2577:18191327 11834:22628830 11785:25836394 10330:26040098 10332:29977502 12821:32041285 10340:36199333 11335:44294710 11806:47489005 11802:54235263 10352:55501236 12825:86901866 10338:124622500 12422:239000000 12424:413907812 12817:815000000 Edited July 5, 2015 by Psvxe Quote Link to comment Share on other sites More sharing options...
Mysteryy Posted July 5, 2015 Share Posted July 5, 2015 Didn't work as I'd want to. This isn't what I'm looking for. Since I need to get the keys sorted on lowest/highest value. rather than lowest/highest key. EDIT: Figured it out. 12603:0 411:70 6697:71 331:72 821:72 890:73 946:73 1205:73 1448:73 5296:74 3347:75 6332:75 1963:76 1969:76 2347:76 3216:76 329:77 361:77 1325:78 43:79 91:79 6043:80 849:81 1309:81 753:83 1944:83 1692:86 4740:87 95:88 1935:89 2862:90 5354:90 5541:90 1151:93 865:94 6962:94 1209:95 1007:96 36:99 1777:99 4823:99 5418:99 6326:99 646:100 847:100 1428:100 1722:100 2136:100 4580:100 5531:100 6981:100 9177:100 9191:100 562:102 1015:102 869:103 2458:103 4821:103 9745:103 6287:104 4325:105 9142:105 12938:105 10824:108 1009:110 1823:110 2114:110 3402:110 1694:112 9379:112 10115:112 809:114 1609:114 1781:115 9042:115 2357:116 2464:116 1757:120 822:121 1957:121 1733:122 662:123 1171:123 1440:123 9452:124 1755:125 2327:126 2355:128 9736:129 10008:130 564:132 4698:133 4345:136 1737:138 1785:138 1937:138 5341:139 1444:140 2865:140 9239:140 1456:141 179:143 1739:146 830:147 1017:147 1775:149 1933:149 363:150 5956:150 1355:151 1635:152 1891:152 6038:157 1837:158 1917:158 319:160 9038:160 9075:160 442:161 892:161 453:163 1793:163 1625:164 1115:166 12934:167 2349:168 4687:169 1794:170 11065:172 2351:175 5312:175 301:177 6330:178 566:179 303:181 6328:181 10148:181 563:182 960:184 1627:184 272:186 816:186 866:186 3138:186 5302:191 9192:191 810:193 2309:193 1743:195 1741:196 9438:197 1067:198 10158:199 2102:200 3381:200 4401:200 5343:200 7919:200 10822:200 1365:201 1951:202 1654:203 377:204 5970:205 434:206 2430:206 853:209 353:210 1673:210 5280:210 9144:211 5320:212 1101:213 1153:213 1452:213 1267:215 560:219 5290:219 6701:220 379:221 6032:221 823:222 9143:225 2:227 10012:228 135:229 970:231 309:232 9338:235 3420:236 1573:238 2460:239 819:240 11069:240 561:241 1540:242 4300:245 2003:246 7225:249 2313:250 2520:250 3034:250 4365:250 5331:250 5543:250 129:252 5376:252 2028:253 1283:255 2112:255 1191:257 8794:257 341:259 288:260 1019:262 68:263 1791:265 1897:265 1157:266 1953:266 1379:269 3046:273 1013:274 11994:275 1211:280 1629:280 1339:281 1105:282 1177:283 3183:284 1833:285 1005:287 4456:287 5986:287 233:289 2162:290 851:291 954:294 1761:294 805:297 9241:298 444:299 660:300 893:300 1389:301 3038:305 5323:305 5016:307 1462:310 532:311 115:313 185:316 530:316 952:316 4302:316 149:317 2026:319 4413:323 2128:326 4125:328 9339:329 1285:331 2169:333 9381:339 133:340 1279:345 12960:345 1193:347 1133:349 1239:350 7054:350 1595:353 371:354 837:357 205:363 1446:370 579:371 1021:376 1297:378 373:383 1295:388 565:392 5621:393 1341:395 447:396 1613:397 5396:399 857:400 3211:400 9179:400 12911:400 3010:401 4337:402 2454:403 1515:405 867:406 243:410 9340:412 1905:416 6319:416 8778:418 1311:423 255:429 9741:437 1143:439 5988:440 983:449 66:451 9243:451 4166:458 5286:460 2432:462 10810:463 6324:464 1611:466 6983:466 113:467 2866:467 2456:469 7178:469 5406:474 5293:479 648:488 1023:490 1027:490 5952:496 1243:499 2325:499 117:500 1179:500 1367:500 2229:500 2307:500 3765:500 4339:500 6609:500 7159:500 10105:500 127:501 1083:506 4812:507 4373:509 147:511 3799:513 632:521 1069:523 2353:525 7944:529 1329:533 97:534 1109:536 5968:539 9242:544 237:548 6703:549 9298:550 544:556 1773:556 3008:557 5943:557 6036:557 1675:559 1909:561 11072:561 3228:567 4353:572 145:584 8009:598 1299:600 5301:600 5478:610 6705:610 975:614 2289:616 4306:616 413:621 630:624 10033:625 8007:627 7946:631 4164:633 2859:649 2970:655 3105:663 464:664 175:665 2452:669 8780:670 11367:670 209:672 235:673 12404:673 3188:677 4331:677 1771:678 658:679 1430:680 1718:681 1767:681 855:686 12403:689 2025:690 2007:691 4168:697 5386:697 4351:699 5497:699 3379:700 8013:703 1769:705 12407:705 7051:707 1237:715 6388:718 1835:720 383:722 5100:723 5458:725 2315:731 9040:736 8010:738 11076:738 4627:740 2902:741 1523:743 1387:746 9739:746 173:750 247:750 4127:750 4367:750 6034:758 3044:759 1181:777 6814:777 405:778 2912:779 3032:781 5370:788 8011:793 5416:799 72:800 2908:800 5954:800 9181:800 3125:802 10282:811 5937:813 626:823 305:825 11260:827 3142:832 8008:832 12640:837 2922:838 5321:845 9305:849 1696:850 5298:866 259:879 5325:879 5438:879 4315:880 10069:889 1765:895 10956:898 5329:899 1245:900 4014:900 10954:900 5974:901 101:905 817:910 385:912 1729:914 6691:920 534:921 3042:922 6322:925 11433:931 365:935 656:938 2297:940 4347:941 4129:948 973:951 1763:954 2436:960 4333:960 642:965 1287:966 4012:975 11951:975 2301:976 2293:989 1119:993 11953:993 10812:996 30:997 2116:997 4551:999 4591:999 1241:1000 3335:1000 4327:1000 4387:1000 4593:1000 9461:1000 177:1001 1698:1004 2930:1004 4850:1005 1313:1017 811:1024 11079:1033 2446:1042 4842:1042 3351:1050 1607:1051 6522:1051 4119:1057 11955:1058 239:1062 1603:1072 861:1074 2568:1084 1357:1091 8015:1094 3767:1096 5627:1099 1641:1102 12631:1107 12411:1110 2485:1111 3434:1115 3020:1123 183:1125 3144:1125 1513:1130 2359:1136 5303:1136 4393:1137 449:1143 9028:1145 2910:1148 5106:1149 1165:1153 11227:1156 2481:1169 1097:1178 5933:1180 1623:1183 5503:1191 1679:1196 245:1205 70:1207 1089:1208 2904:1212 1197:1213 542:1219 10020:1221 1660:1225 575:1241 628:1250 2015:1255 11085:1255 1605:1262 10034:1268 5972:1274 11088:1276 12408:1280 1065:1313 8790:1325 161:1332 2084:1340 2932:1342 8782:1348 1725:1350 1145:1357 215:1360 573:1362 1656:1366 11934:1399 167:1405 1949:1420 5001:1424 1637:1427 859:1440 4684:1450 3040:1451 10075:1456 1724:1461 1361:1497 4529:1499 6357:1499 650:1500 1677:1500 4411:1500 5499:1500 6008:1500 6135:1500 10016:1500 1621:1503 1753:1508 1383:1513 7650:1517 181:1521 225:1521 571:1525 10496:1525 868:1534 1619:1534 12615:1534 1639:1541 165:1546 9733:1549 11237:1551 1159:1552 6392:1570 1474:1575 267:1579 2487:1597 6390:1607 3363:1611 640:1625 1592:1627 1071:1636 1381:1638 217:1639 265:1644 2934:1666 1745:1674 1011:1675 1301:1675 569:1676 1269:1678 10302:1678 1472:1685 11992:1702 5299:1707 6018:1712 1085:1715 1476:1716 9193:1717 12972:1739 11212:1746 1597:1756 2448:1760 5667:1762 10472:1763 3365:1766 3030:1770 548:1773 4548:1775 3049:1783 107:1791 211:1792 654:1799 6416:1800 10931:1800 2998:1811 1751:1814 3853:1818 2550:1834 3226:1850 171:1854 261:1857 1195:1868 2552:1871 1385:1873 1727:1875 7196:1880 1643:1888 12974:1888 6367:1900 6625:1900 9244:1913 2906:1918 143:1920 9341:1924 3002:1944 109:1946 2505:1949 1658:1950 4369:1950 2876:1953 8012:1960 1161:1964 7060:1983 1029:2000 4363:2000 4409:2000 6313:2000 7124:2000 4207:2003 11959:2020 103:2025 546:2041 7218:2056 10306:2072 1601:2078 1700:2085 11092:2088 3791:2090 1273:2097 11936:2099 2011:2100 12410:2103 12962:2112 1662:2145 1183:2171 991:2175 4310:2182 1345:2191 2570:2191 9419:2196 1271:2197 1371:2208 1099:2221 1470:2245 1731:2245 12629:2257 5521:2268 6133:2268 2361:2272 3018:2284 7198:2291 2522:2312 3789:2327 213:2331 2493:2343 12279:2348 12616:2370 4827:2383 263:2397 1478:2400 12984:2407 5574:2411 2489:2452 169:2453 11229:2455 163:2460 4304:2474 12778:2496 11095:2500 12275:2500 6689:2523 10298:2537 1442:2544 6812:2565 3473:2566 105:2580 536:2584 2491:2591 12285:2612 5018:2633 12614:2636 6623:2650 7319:2651 10958:2676 1327:2677 3367:2699 7358:2700 11090:2700 2890:2715 1747:2778 2217:2782 1749:2788 3339:2788 9183:2810 8872:2884 12775:2920 5028:2930 6693:2931 2495:2957 7334:2957 2509:2960 6382:2993 4403:2999 159:3027 3777:3033 7340:3039 10156:3049 10079:3051 10296:3084 1121:3093 3016:3129 2942:3174 11232:3179 1617:3197 2940:3197 2442:3206 11230:3219 7418:3227 1199:3246 12777:3288 10426:3289 2601:3300 3391:3314 4323:3330 581:3333 12919:3371 10476:3413 12907:3413 12779:3436 10043:3486 4537:3500 12776:3500 2444:3511 10085:3541 4308:3546 1317:3557 1315:3619 1073:3652 6687:3662 4417:3684 9634:3687 1077:3709 6629:3716 157:3720 189:3784 141:3795 5751:3808 6016:3833 5287:3847 12905:3873 8880:3878 10280:3900 7416:3958 3781:3999 4440:4000 10041:4000 10045:4025 1033:4044 3028:4067 9678:4137 10438:4147 11943:4148 3801:4161 1959:4166 2497:4196 11250:4202 2605:4216 4860:4228 5500:4383 1135:4425 1125:4466 12701:4491 5046:4500 7370:4521 1331:4536 5678:4548 10077:4561 577:4581 1035:4603 12627:4702 1213:4713 2440:4949 5576:4964 6685:4997 6619:4998 5042:4999 7122:4999 197:5000 2639:5000 5044:5000 5547:5000 7134:5000 8792:5000 397:5001 12245:5003 7384:5007 12289:5055 3448:5121 6617:5147 2499:5315 7374:5380 3026:5397 3343:5401 10434:5451 12642:5455 9998:5500 10127:5501 12293:5555 5575:5584 5288:5596 4117:5654 4105:5704 5940:5783 4156:5794 4115:5822 3475:5823 1961:5837 207:5851 12625:5869 257:5905 3051:5912 4095:5937 139:5994 9845:5999 389:6000 7372:6001 12917:6004 3000:6019 12409:6219 307:6250 99:6290 3004:6367 12297:6384 12613:6391 1091:6398 3827:6406 12331:6435 987:6480 12402:6549 10440:6661 6339:6714 2450:6715 12520:6794 7208:6873 4371:6901 12287:6911 3779:6926 2064:6989 12490:7004 219:7021 7668:7030 9672:7041 3107:7320 5755:7387 10826:7400 1359:7466 5501:7480 2914:7499 3828:7528 10081:7528 10322:7602 2501:7739 6729:7771 7323:7832 3024:7866 12291:7886 4097:7907 2503:7928 269:7955 12239:7999 6377:8000 4121:8060 9638:8077 13000:8104 1391:8142 10071:8161 2434:8171 12217:8291 9194:8298 5516:8500 6631:8548 12223:8592 1432:8650 12317:8686 9342:8719 12327:8767 9245:8792 12405:8826 12865:8881 9856:8999 9864:8999 9867:8999 3830:9012 8878:9038 12341:9080 1399:9102 1397:9120 5313:9151 3053:9188 5371:9317 1395:9348 9676:9383 1393:9486 13066:9590 10474:9622 12699:9638 1123:9690 7132:9700 10470:9782 9465:9950 10422:9999 3393:10000 9636:10000 9640:10000 9642:10000 9431:10012 12325:10026 8423:10300 10398:10809 4109:10813 4131:10841 9185:10875 2603:10971 981:11320 1147:11326 10927:11575 1989:11750 2609:11800 451:11864 2649:11978 3200:12000 5747:12202 9674:12250 2641:12275 1229:12286 6337:12404 11252:12455 1289:12480 3829:12665 12915:12678 12988:12744 4834:12908 1247:12933 12333:13000 7382:13097 12518:13153 12496:13167 12323:13301 10376:13333 2363:13384 12913:13425 12697:13886 6345:13898 10925:14040 12867:14488 4089:14490 12783:14515 12361:14540 2476:14621 4099:14800 12257:14858 4170:14884 5692:15000 12215:15000 2651:15127 10442:15333 12385:15484 6259:15658 6402:15761 6335:15864 12283:16000 10366:16207 7327:16208 10380:16365 6237:16500 4107:16525 1333:16530 12871:16567 12695:17005 2587:17083 12869:17202 2589:17244 6351:17255 1664:17381 10039:17500 10382:17610 12263:18000 10414:18056 1645:18282 12281:18363 2572:18419 1303:18688 12199:18763 1347:18969 1275:19306 12406:19406 12443:19483 985:19548 5680:19607 1215:19787 1231:19903 5295:19933 2645:19999 391:20000 6418:20000 9861:20000 11115:20000 11244:20000 10589:20010 10292:20080 12530:20197 7380:20709 11113:20781 1163:20895 1615:20975 2611:21000 12466:21021 7388:21220 12522:21635 6760:21652 1631:21767 7362:21850 7400:21898 11980:22310 1702:22478 1050:22801 1704:22884 11972:22898 9668:23000 1712:23367 5300:23473 11126:23484 11968:23514 6349:23594 11254:23684 10288:23858 6141:24003 9731:24126 3389:24384 1185:24432 1373:24572 2627:24702 13012:24711 12269:24999 13155:25000 6317:25043 12277:25250 11978:25273 12381:25422 993:25501 11105:25735 5289:25764 1053:25767 12786:25915 11118:25969 1407:26242 1403:26276 1401:26358 1405:26361 3385:26393 1055:26841 4732:26956 10420:27014 5698:27069 10294:27119 12486:27200 2633:27370 12265:27500 989:27846 5502:27990 12365:28000 12504:28000 12502:28250 10416:28815 12476:28944 3387:28980 1113:29008 8429:29500 2675:29534 13014:29998 12329:30144 6139:30244 10286:30468 7342:30614 10374:30903 7348:31650 1057:31910 1040:32125 10290:32490 1434:32947 12301:33282 12478:33500 12494:33962 12447:34166 1201:34221 12305:34279 10828:34404 4153:34490 12488:34868 12482:34875 5304:34951 10458:34997 2647:35000 12789:35000 12468:35585 12321:35694 1046:35825 1044:36109 2629:36330 12299:36740 2635:36990 12462:37158 10390:37392 3836:37491 12193:37975 6215:38052 10462:38080 12474:38205 3755:38439 3122:38478 1038:38624 1079:38746 12472:39325 12464:39710 12315:39777 12512:39800 3476:39984 12303:40000 1093:40037 2637:40054 3480:40368 3479:40418 1319:40494 3478:40668 12233:41009 4708:41103 3838:41535 3477:41623 12498:41682 2673:42000 12460:42083 6809:42138 6129:42235 3202:42251 5314:42278 12375:42305 12267:42979 5372:43193 10384:43939 11990:44000 12532:44335 11902:44339 1127:44408 2619:44409 10466:44531 3835:44625 2625:44769 13016:45100 2623:45164 2669:45211 12470:45500 12363:46000 10364:46133 6130:46494 4103:46933 1048:47789 2671:47928 13149:49198 3749:49383 12528:49837 10402:49998 12347:49998 4093:50000 9851:50000 10406:50000 2607:50258 3837:50429 10354:52028 3751:52087 2615:52290 4113:52526 7336:53000 3753:53275 2657:53903 9472:55000 12255:55000 2593:56943 4710:57355 12271:58490 7386:60000 10362:60300 2621:60464 1149:60605 12623:60710 12369:61512 12514:62123 12249:62556 2617:63358 12624:63932 12253:64212 5315:64741 12492:65111 12500:65227 1305:65589 4587:66733 4956:67003 12195:68928 11964:69000 2665:69874 12203:70039 4675:70355 5373:71495 7398:71593 12621:72212 5316:73214 12622:73217 12237:73839 2643:74700 12395:75000 10454:76219 10378:76858 5374:76996 2655:77124 7396:77481 12800:78880 7392:79999 8928:80000 4091:81175 4101:81216 962:82098 7399:82683 5757:84880 12936:85005 4745:85825 12259:86766 12251:87796 12506:90092 13175:90272 12798:91000 4111:93359 5743:95000 13020:95637 12231:96310 2663:97366 10452:98092 4986:99003 12:100000 12802:100000 2659:100181 13008:103052 10464:106675 4747:107044 5730:109536 1249:110413 2653:111315 2661:111402 13004:111716 4755:112856 12534:113203 2667:114457 4938:115000 11840:115763 7378:117197 6562:117569 12849:118757 10564:119753 10400:121202 10388:122116 10456:123078 10368:123305 12829:123452 6724:123825 4738:127891 12510:128012 10372:131057 12439:133333 2366:134275 7394:136200 8784:136506 1042:138549 12355:139800 1377:140497 10468:141390 13024:142977 13171:144094 13026:146038 13028:148275 12757:149999 12393:150000 12441:152889 11787:157390 12771:157500 12205:158616 12769:159810 12397:160000 13052:163113 6563:163781 11280:164037 7158:166465 3204:167475 11818:168000 12197:168253 12455:168283 11820:169000 11037:169683 10448:169785 12373:172800 6523:173333 6524:173764 12261:174178 12273:174500 12617:177375 11822:182203 4968:184101 4585:184250 4087:185052 10394:190000 12508:193491 6528:193825 12243:195714 4734:197156 8:200055 6:201339 12763:202547 13048:204052 12451:212092 13056:213580 4884:215007 13153:222885 4757:226214 10386:226378 10:228771 13032:230788 4728:236962 11789:243920 6739:244148 12619:244248 4890:246007 3488:250000 4974:250009 11932:255993 6731:259918 4716:260829 12620:260888 11256:273499 12851:278500 12432:279995 4730:291238 4749:294777 13159:312806 6735:317049 12996:317710 11928:321724 4718:324768 3481:324907 4751:325334 12225:328372 8786:329978 11929:338550 12968:348827 13173:349004 10446:360580 1187:364818 4872:365100 13044:372115 12335:372180 11836:377013 4878:380050 13163:385500 12618:386715 6568:387843 13040:404333 4902:406355 12536:412000 10450:416397 11908:428887 12004:431091 10370:445639 4712:460645 4714:463504 7390:466525 4722:480793 12357:483671 13042:490002 4980:500000 12929:515882 2579:518806 11798:540740 12932:548748 4896:551007 9470:560201 12235:569696 12927:583412 12351:592848 12976:603100 4753:635137 8901:680390 4720:690535 8921:695835 12002:728980 12833:735000 12863:750823 4224:760870 11826:794125 12879:870958 3834:917616 12831:918268 4212:925000 4998:937501 12881:998547 13038:1000000 12980:1051500 12900:1056728 12598:1073411 4944:1117000 13157:1125000 3833:1164046 12383:1180540 4759:1186321 3831:1187559 3832:1277197 4736:1294697 11235:1321925 11905:1396383 11920:1408950 6920:1467448 12337:1571420 3483:1583170 13190:1641661 12883:1666466 12877:1726841 11838:1782033 3140:1888206 12399:1963219 4151:2074017 12875:2200795 2581:2225243 13036:2438844 9050:2759102 9044:2837390 11128:2847443 12371:2956991 6585:2984111 6571:2986105 11133:3130338 6737:3237060 11933:3355500 12605:3358653 6733:3372024 11812:3621420 11924:3722306 6914:3884738 11808:3889376 11804:4275398 6918:4288319 6916:4407006 12391:4450000 12922:4689334 13151:4707947 12924:4745284 4724:5148659 6924:5240000 11926:5614621 11998:5931166 12000:6011222 6889:6547654 11824:7563891 11889:7750037 12596:7756104 12526:8008186 4726:8892852 11832:10550303 11828:13366751 11791:14008534 12902:14566015 12873:14723553 12601:15240000 11830:16080598 10350:16312312 11284:17283147 11286:17742301 2577:18191327 11834:22628830 11785:25836394 10330:26040098 10332:29977502 12821:32041285 10340:36199333 11335:44294710 11806:47489005 11802:54235263 10352:55501236 12825:86901866 10338:124622500 12422:239000000 12424:413907812 12817:815000000 Dont forget about stacked items. 10 noted items at 2k each should be prioritized over a single item worth 3k even though the 3k is worth more individually. 1 Quote Link to comment Share on other sites More sharing options...
Psvxe Posted July 5, 2015 Author Share Posted July 5, 2015 Dont forget about stacked items. 10 noted items at 2k each should be prioritized over a single item worth 3k even though the 3k is worth more individually. Thanks for that, I'll add that! Quote Link to comment Share on other sites More sharing options...
Mysteryy Posted July 5, 2015 Share Posted July 5, 2015 Thanks for that, I'll add that! The code that I sent you will return the price including the stack size of the item. Not sure if you are using that or not. :p Quote Link to comment Share on other sites More sharing options...
Alek Posted July 5, 2015 Share Posted July 5, 2015 You might want to look at comparators if you get a chance: http://docs.oracle.com/javase/7/docs/api/java/util/Comparator.html Quote Link to comment Share on other sites More sharing options...
Psvxe Posted July 5, 2015 Author Share Posted July 5, 2015 The code that I sent you will return the price including the stack size of the item. Not sure if you are using that or not. I'm not using the class since I'd create my own class already (before you'd sent it). However there are some improvements I made from the class you'd sent me including stackables :3 Quote Link to comment Share on other sites More sharing options...
FrostBug Posted July 5, 2015 Share Posted July 5, 2015 (edited) You can't sort a hashmap.. It's hashed.. A priority queue would be your best bet IMO, depending on the situation ofc. Make a wrapper class to hold your 2 ints, let the wrapper class implement the comparable interface (compare by key value), and they'll be automatically sorted as you insert them into the PQ Edited July 5, 2015 by FrostBug Quote Link to comment Share on other sites More sharing options...