Class ServerView

java.lang.Object
dev.twilite.game.stream.View<Server>
dev.twilite.game.stream.ServerView
All Implemented Interfaces:
Iterable<Server>

public class ServerView extends View<Server>
Lazy view over loaded server-list entries.
  • Constructor Details

    • ServerView

      public ServerView(Supplier<Stream<Server>> source)
      Creates a server view backed by a stream supplier.
  • Method Details

    • filter

      public ServerView filter(Predicate<Server> filter)
      Returns a new server view with an additional filter.
      Overrides:
      filter in class View<Server>
    • not

      public ServerView not()
      Returns a new server view with the most recent filter negated.
      Overrides:
      not in class View<Server>
    • or

      public ServerView or(Predicate<Server> filter)
      Returns a new server view with the supplied filter OR'ed with the most recent filter.
      Overrides:
      or in class View<Server>
    • includeCurrent

      public ServerView includeCurrent()
      Includes the current server in this view.
    • id

      public ServerView id(int... ids)
      Filters servers by world id.
    • activity

      public ServerView activity(Predicate<String> activity)
      Filters servers by activity text.
    • location

      public ServerView location(Server.Location... locations)
      Filters servers by location.
    • members

      public ServerView members()
      Filters members-only servers.
    • flag

      public ServerView flag(Server.Flag... flags)
      Filters servers by property flag.
    • population

      public ServerView population(int min, int max)
      Filters servers by inclusive population range.
    • next

      public Optional<Server> next()
      Returns the next matching server after the current server, wrapping to the lowest id when needed.
    • previous

      public Optional<Server> previous()
      Returns the previous matching server before the current server, wrapping to the highest id when needed.
    • random

      public Optional<Server> random()
      Returns a random matching server.
    • stream

      public Stream<Server> stream()
      Opens a stream of matching servers.
      Overrides:
      stream in class View<Server>