java_primer
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| java_primer [2020/08/23 17:14] – [NOTES] jrseti | java_primer [2020/11/19 17:19] (current) – [LinkedHashMap] jrseti | ||
|---|---|---|---|
| Line 20: | Line 20: | ||
| ====LinkedHashMap==== | ====LinkedHashMap==== | ||
| + | |||
| + | **An OrderedDict!** | ||
| Same as hashMap but preserves **insertion order**. O(1) insertion and lookup. | Same as hashMap but preserves **insertion order**. O(1) insertion and lookup. | ||
| Line 171: | Line 173: | ||
| * a / b = Math.exp(Math.log(a) - Math.log(b)) | * a / b = Math.exp(Math.log(a) - Math.log(b)) | ||
| + | |||
| + | ====Random==== | ||
| + | |||
| + | < | ||
| + | //Random number from 0 to 5 | ||
| + | Random rand = new Random(); | ||
| + | int r = rand.nextInt(6); | ||
| + | </ | ||
| + | |||
| + | or | ||
| + | |||
| + | < | ||
| + | //Number between 0.0 and 1.0; | ||
| + | Math.random(); | ||
| + | </ | ||
| + | |||
java_primer.1598202856.txt.gz · Last modified: 2020/08/23 17:14 by jrseti