001 package com.croftsoft.core.util.seq;
002
003 import com.croftsoft.core.lang.NullException;
004
005 /***********************************************************************
006 * Read-only access to an array.
007 *
008 * @version
009 * $Id: ArraySeq.java,v 1.1 2008/07/19 21:10:27 croft Exp $
010 * @since
011 * 2007-07-19
012 * @author
013 * <a href="http://www.CroftSoft.com/">David Wallace Croft</a>
014 ***********************************************************************/
015
016 public final class ArraySeq<E>
017 implements Seq<E>
018 ////////////////////////////////////////////////////////////////////////
019 ////////////////////////////////////////////////////////////////////////
020 {
021
022 private final E [ ] array;
023
024 ////////////////////////////////////////////////////////////////////////
025 ////////////////////////////////////////////////////////////////////////
026
027 public ArraySeq ( final E... array )
028 ////////////////////////////////////////////////////////////////////////
029 {
030 NullException.check ( this.array = array );
031 }
032
033 ////////////////////////////////////////////////////////////////////////
034 ////////////////////////////////////////////////////////////////////////
035
036 public int size ( )
037 ////////////////////////////////////////////////////////////////////////
038 {
039 return array.length;
040 }
041
042 public E get ( int index )
043 ////////////////////////////////////////////////////////////////////////
044 {
045 return array [ index ];
046 }
047
048 ////////////////////////////////////////////////////////////////////////
049 ////////////////////////////////////////////////////////////////////////
050 }