Skip to content

Commit 8fc6e60

Browse files
committed
Use OptionalInt instead of Optional<Integer>
1 parent bd79dd7 commit 8fc6e60

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/main/java/org/kitteh/irc/client/library/defaults/element/isupport/DefaultISupportParameterOptionalInteger.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import org.kitteh.irc.client.library.defaults.element.DefaultISupportParameter;
3030
import org.kitteh.irc.client.library.element.ISupportParameter;
3131

32-
import java.util.Optional;
32+
import java.util.OptionalInt;
3333

3434
/**
3535
* Default implementation of {@link OptionalIntegerParameter}.
@@ -56,7 +56,7 @@ protected DefaultISupportParameterOptionalInteger(@NonNull Client client, @NonNu
5656
}
5757

5858
@Override
59-
public Optional<Integer> getInteger() {
60-
return Optional.ofNullable(this.integer);
59+
public OptionalInt getInteger() {
60+
return this.integer == null ? OptionalInt.empty() : OptionalInt.of(this.integer);
6161
}
6262
}

src/main/java/org/kitteh/irc/client/library/element/ISupportParameter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.util.List;
3131
import java.util.Map;
3232
import java.util.Optional;
33+
import java.util.OptionalInt;
3334
import java.util.Set;
3435

3536
/**
@@ -57,7 +58,7 @@ interface OptionalIntegerParameter extends ISupportParameter {
5758
*
5859
* @return the processed value
5960
*/
60-
Optional<Integer> getInteger();
61+
OptionalInt getInteger();
6162
}
6263

6364
/**

0 commit comments

Comments
 (0)