Skip to content

Commit dd2bdc4

Browse files
committed
use Map.of
1 parent 66c4299 commit dd2bdc4

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

src/main/java/processing/awt/PGraphicsJava2D.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1969,13 +1969,11 @@ protected void handleTextSize(float size) {
19691969
// don't derive again if the font size has not changed
19701970
if (font != null) {
19711971
if (font.getSize2D() != size) {
1972-
Map<TextAttribute, Object> map =
1973-
new HashMap<>();
1974-
map.put(TextAttribute.SIZE, size);
1975-
map.put(TextAttribute.KERNING,
1976-
TextAttribute.KERNING_ON);
1977-
// map.put(TextAttribute.TRACKING,
1978-
// TextAttribute.TRACKING_TIGHT);
1972+
Map<TextAttribute, Object> map = Map.of(
1973+
TextAttribute.SIZE, size,
1974+
TextAttribute.KERNING, TextAttribute.KERNING_ON
1975+
);
1976+
// TextAttribute.TRACKING, TextAttribute.TRACKING_TIGHT);
19791977
font = font.deriveFont(map);
19801978
}
19811979
g2.setFont(font);

src/main/java/processing/opengl/PSurfaceJOGL.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ public void setAlwaysOnTop(final boolean always) {
514514
*
515515
*/
516516
protected void initIcons() {
517-
IOUtil.ClassResources res = null;
517+
IOUtil.ClassResources res;
518518
if (PJOGL.icons == null || PJOGL.icons.length == 0) {
519519
// Default Processing icons
520520
final int[] sizes = {16, 32, 48, 64, 128, 256, 512};
@@ -542,7 +542,7 @@ protected void initIcons() {
542542
@SuppressWarnings("resource")
543543
private String resourceFilename(String filename) {
544544
// The code below comes from PApplet.createInputRaw() with a few adaptations
545-
InputStream stream = null;
545+
InputStream stream;
546546
try {
547547
// First see if it's in a data folder. This may fail by throwing
548548
// a SecurityException. If so, this whole block will be skipped.
@@ -1371,16 +1371,15 @@ void set() {
13711371
}
13721372

13731373
static Map<Integer, CursorInfo> cursors = new HashMap<>();
1374-
static Map<Integer, String> cursorNames = new HashMap<>();
1375-
1376-
static {
1377-
cursorNames.put(PConstants.ARROW, "arrow");
1378-
cursorNames.put(PConstants.CROSS, "cross");
1379-
cursorNames.put(PConstants.WAIT, "wait");
1380-
cursorNames.put(PConstants.MOVE, "move");
1381-
cursorNames.put(PConstants.HAND, "hand");
1382-
cursorNames.put(PConstants.TEXT, "text");
1383-
}
1374+
static Map<Integer, String> cursorNames = Map.of(
1375+
PConstants.ARROW, "arrow",
1376+
PConstants.CROSS, "cross",
1377+
PConstants.WAIT, "wait",
1378+
PConstants.MOVE, "move",
1379+
PConstants.HAND, "hand",
1380+
PConstants.TEXT, "text"
1381+
);
1382+
13841383

13851384
@Override
13861385
public void setCursor(int kind) {

0 commit comments

Comments
 (0)