<commit_before>
package cz.seznam.euphoria.core.client.util;

import java.util.Objects;

/**
 * Either LEFT or RIGHT element.
 */
public final class Either<LEFT, RIGHT> {

  final LEFT left;
  final RIGHT right;

  public static <LEFT, RIGHT> Either<LEFT, RIGHT> left(LEFT left) {
    Objects.requireNonNull(left);
    return new Either<>(left, (RIGHT) null);
  }


  public static <LEFT, RIGHT> Either<LEFT, RIGHT> right(RIGHT right) {
    Objects.requireNonNull(right);
    return new Either<>((LEFT) null, right);
  }


  private Either(LEFT left, RIGHT right) {
    this.left = left;
    this.right = right;
  }

<commit_msg>#! Resuse Either#lift<commit_after>
package cz.seznam.euphoria.core.client.util;

import cz.seznam.euphoria.core.client.functional.UnaryFunction;

import static java.util.Objects.requireNonNull;

/**
 * Either LEFT or RIGHT element.
 */
public final class Either<LEFT, RIGHT> {

  final LEFT left;
  final RIGHT right;

  public static <I, O> UnaryFunction<Either<I, I>, O> lift(UnaryFunction<I, O> f) {
    requireNonNull(f);
    return (e) -> f.apply(e.isLeft() ? e.left() : e.right());
  }

  public static <LEFT, RIGHT> Either<LEFT, RIGHT> left(LEFT left) {
    requireNonNull(left);
    return new Either<>(left, (RIGHT) null);
  }


  public static <LEFT, RIGHT> Either<LEFT, RIGHT> right(RIGHT right) {
    requireNonNull(right);
    return new Either<>((LEFT) null, right);
  }


  private Either(LEFT left, RIGHT right) {
    this.left = left;
    this.right = right;
  }


{'fraction_non_alphanumeric': 0.1369953673064196, 'fraction_numerical': 0.0, 'mean_word_length': 3.710280373831776, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7662507', 'n_tokens_mistral': 533, 'n_tokens_neox': 501, 'n_words': 137}