All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.redis.om.spring.tuple.Single Maven / Gradle / Ivy

package com.redis.om.spring.tuple;

import com.redis.om.spring.tuple.accessor.FirstAccessor;

public interface Single extends Tuple {

  T0 getFirst();

  @Override
  default int size() {
    return 1;
  }

  default Object get(int index) {
    if (index == 0) {
      return getFirst();
    } else {
      throw new IndexOutOfBoundsException(
          String.format("Index %d is outside bounds of tuple of degree %s", index, size()));
    }
  }

  static  FirstAccessor, T0> getFirstGetter() {
    return Single::getFirst;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy