package fr.umlv.spined; 

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * A non-mutable linked list where each link contains several values in an array.
 */
public class SpinedBuffer {
  private final Object[] values;
  private final SpinedBuffer next;
  
  /**
   * Creates a new link of the linked list containing several values.
   * @param values the values contained in the link.
   * @param next a reference to the next link or null if it's the last link.
   */
  public SpinedBuffer(Object[] values, SpinedBuffer next) {
    this.values = values;
    this.next = next;
  }
  
  /**
   * Returns an unmodifiable list of the values of the current link.
   * @return an unmodifiable list of the values of the current link.
   */
  List<Object> getValues() {
    return Collections.unmodifiableList(Arrays.asList(values));
  }
}
