001 package edu.jhu.mb.ernst.util.seq; 002 003 import java.util.*; 004 005 /*********************************************************************** 006 * Read-only access to a List. 007 * 008 * @version 009 * $Date: 2012-04-15 13:06:25 -0500 (Sun, 15 Apr 2012) $ 010 * $Rev: 7 $ 011 * $Author: croft $ 012 * @since 013 * 2007-07-19 014 * @author 015 * <a href="http://www.CroftSoft.com/">David Wallace Croft</a> 016 ***********************************************************************/ 017 018 public final class ListSeq<E> 019 implements Seq<E> 020 //////////////////////////////////////////////////////////////////////// 021 //////////////////////////////////////////////////////////////////////// 022 { 023 024 private final List<? extends E> list; 025 026 //////////////////////////////////////////////////////////////////////// 027 //////////////////////////////////////////////////////////////////////// 028 029 public ListSeq ( final List<? extends E> list ) 030 //////////////////////////////////////////////////////////////////////// 031 { 032 if ( list == null ) 033 { 034 throw new IllegalArgumentException ( "null" ); 035 } 036 037 this.list = list; 038 } 039 040 //////////////////////////////////////////////////////////////////////// 041 //////////////////////////////////////////////////////////////////////// 042 043 public int size ( ) 044 //////////////////////////////////////////////////////////////////////// 045 { 046 return list.size ( ); 047 } 048 049 public E get ( int index ) 050 //////////////////////////////////////////////////////////////////////// 051 { 052 return list.get ( index ); 053 } 054 055 //////////////////////////////////////////////////////////////////////// 056 //////////////////////////////////////////////////////////////////////// 057 }