Skip to content

Commit

Permalink
Cleanup + @SuppressWarnings
Browse files Browse the repository at this point in the history
  • Loading branch information
strubium committed Oct 15, 2024
1 parent b2d1d50 commit c3dfdeb
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/main/java/mcjty/theoneprobe/gui/PresetBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
* The Builder to make a new preset, basically for GroovyScript compact
*
* @since 10/15/2024
* @author strubium
*/
@SuppressWarnings("unused") //This is suppressed because most of these are added for groovy compact
public class PresetBuilder {

private static final List<Preset> presets = new ArrayList<>();
Expand Down Expand Up @@ -64,20 +64,16 @@ public PresetBuilder addTextStyleClass(TextStyleClass styleClass, String styleNa

// Build method to construct the Preset object and add it to the static presets list
public Preset build() {
// Convert the Map entries to an array of Pair<TextStyleClass, String>
List<Pair<TextStyleClass, String>> stylePairs = textStyleClasses.entrySet()
.stream()
.map(entry -> Pair.of(entry.getKey(), entry.getValue()))
.collect(Collectors.toList());

// Create the new Preset object
Preset preset = new Preset(
name,
boxBorderColor,
boxFillColor,
boxThickness,
boxOffset,
stylePairs.toArray(new Pair[0])
textStyleClasses.entrySet()
.stream()
.map(entry -> Pair.of(entry.getKey(), entry.getValue())).toArray(Pair[]::new)
);

// Add the newly created preset to the static list
Expand Down

0 comments on commit c3dfdeb

Please sign in to comment.