001// -------------------------------------------------------------------------------- 002// Copyright 2002-2024 Echo Three, LLC 003// 004// Licensed under the Apache License, Version 2.0 (the "License"); 005// you may not use this file except in compliance with the License. 006// You may obtain a copy of the License at 007// 008// http://www.apache.org/licenses/LICENSE-2.0 009// 010// Unless required by applicable law or agreed to in writing, software 011// distributed under the License is distributed on an "AS IS" BASIS, 012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013// See the License for the specific language governing permissions and 014// limitations under the License. 015// -------------------------------------------------------------------------------- 016 017package com.echothree.util.common.transfer; 018 019import java.util.ArrayList; 020import java.util.Collection; 021import java.util.List; 022 023public class ListWrapper<E> 024 implements BaseWrapper<E> { 025 026 private List<E> list; 027 028 /** Creates a new instance of ListWrapper from a List */ 029 public ListWrapper(List<E> list) { 030 this.list = list; 031 } 032 033 /** Creates a new instance of ListWrapper from a Collection */ 034 public ListWrapper(Collection<E> set) { 035 this.list = new ArrayList<>(set); 036 } 037 038 @Override 039 public List<E> getList() { 040 return list; 041 } 042 043 @Override 044 public Collection<E> getCollection() { 045 return list; 046 } 047 048 @Override 049 public int getSize() { 050 return list.size(); 051 } 052 053}