Improve InstanceManager#getInstance comment

This commit is contained in:
themode 2021-01-25 10:21:10 +01:00
parent d733dbbc3f
commit 886c4ca9c9

View File

@ -155,17 +155,17 @@ public final class InstanceManager {
} }
/** /**
* Gets instance by given UUID. * Gets an instance by the given UUID.
* *
* @param uuid UUID of the instance * @param uuid UUID of the instance
* @return {@link Optional#empty()} if instance is not found * @return the instance with the given UUID, null if not found
*/ */
@NotNull @Nullable
public @Nullable Instance getInstance(UUID uuid) { public Instance getInstance(@NotNull UUID uuid) {
Optional<Instance> instance = getInstances() Optional<Instance> instance = getInstances()
.stream() .stream()
.filter(someInstance -> someInstance.getUniqueId().equals(uuid)) .filter(someInstance -> someInstance.getUniqueId().equals(uuid))
.findFirst(); .findFirst();
return instance.orElse(null); return instance.orElse(null);
} }