001 package com.croftsoft.core.util.seq; 002 003 import java.util.*; 004 005 import com.croftsoft.core.lang.NullException; 006 007 /*********************************************************************** 008 * Read-only access to a List. 009 * 010 * @version 011 * $Id: ListSeq.java,v 1.1 2008/07/19 22:12:36 croft Exp $ 012 * @since 013 * 2007-07-19 014 * @author 015 * <a href="https://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 NullException.check ( this.list = list ); 033 } 034 035 //////////////////////////////////////////////////////////////////////// 036 //////////////////////////////////////////////////////////////////////// 037 038 public int size ( ) 039 //////////////////////////////////////////////////////////////////////// 040 { 041 return list.size ( ); 042 } 043 044 public E get ( int index ) 045 //////////////////////////////////////////////////////////////////////// 046 { 047 return list.get ( index ); 048 } 049 050 //////////////////////////////////////////////////////////////////////// 051 //////////////////////////////////////////////////////////////////////// 052 }