@@ -0,0 +1,1479 @@
+package fi.vincit.multiusertest.util;%0A%0Aimport java.util.NoSuchElementException;%0Aimport java.util.Objects;%0A%0A/**%0A * A custom optional class that works in Java 7 so%0A * that Java 8 isn't needed%0A */%0Apublic class Optional%3CT%3E %7B%0A%0A    private static final Optional EMPTY = of(null);%0A%0A    private T value;%0A%0A    Optional(T value) %7B%0A        this.value = value;%0A    %7D%0A%0A    public static %3CT%3E Optional ofNullable(T value) %7B%0A        return new Optional%3C%3E(value);%0A    %7D%0A%0A    public static %3CT%3E Optional of(T value) %7B%0A        Objects.requireNonNull(value);%0A        return new Optional%3C%3E(value);%0A    %7D%0A%0A    public static %3CT%3E Optional%3CT%3E empty() %7B%0A        return EMPTY;%0A    %7D%0A%0A    public T get() %7B%0A        if (isPresent()) %7B%0A            return value;%0A        %7D else %7B%0A            throw new NoSuchElementException(%22Value must no be null%22);%0A        %7D%0A    %7D%0A%0A    public T orElse(T otherValue) %7B%0A        if (isPresent()) %7B%0A            return value;%0A        %7D else %7B%0A            return otherValue;%0A        %7D%0A    %7D%0A%0A    public boolean isPresent() %7B%0A        return value != null;%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object other) %7B%0A        if (this == other) %7B%0A            return true;%0A        %7D%0A%0A        if (other == null %7C%7C getClass() != other.getClass()) %7B%0A            return false;%0A        %7D%0A%0A        Optional%3C?%3E optional = (Optional%3C?%3E) other;%0A        return Objects.equals(value, optional.value);%0A    %7D%0A%0A    @Override%0A    public int hashCode() %7B%0A        return Objects.hash(value);%0A    %7D%0A%7D%0A

Add optional class