1 /* 2 * Copyright 2004 The Apache Software Foundation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package javax.faces.component; 17 18 import java.util.Iterator; 19 import java.util.List; 20 import java.util.Map; 21 import java.util.NoSuchElementException; 22 23 /** 24 * @author Manfred Geiler (latest modification by $Author: mwessendorf $) 25 * @version $Revision: 166994 $ $Date: 2004-07-01 18:12:40 -0400 (Thu, 01 Jul 2004) $ 26 */ 27 class _FacetsAndChildrenIterator 28 implements Iterator 29 { 30 private Iterator _facetsIterator; 31 private Iterator _childrenIterator; 32 33 _FacetsAndChildrenIterator(Map facetMap, List childrenList) 34 { 35 _facetsIterator = facetMap != null ? facetMap.values().iterator() : null; 36 _childrenIterator = childrenList != null ? childrenList.iterator() : null; 37 } 38 39 public boolean hasNext() 40 { 41 return (_facetsIterator != null && _facetsIterator.hasNext()) || 42 (_childrenIterator != null && _childrenIterator.hasNext()); 43 } 44 45 public Object next() 46 { 47 if (_facetsIterator != null && _facetsIterator.hasNext()) 48 { 49 return _facetsIterator.next(); 50 } 51 else if (_childrenIterator != null && _childrenIterator.hasNext()) 52 { 53 return _childrenIterator.next(); 54 } 55 else 56 { 57 throw new NoSuchElementException(); 58 } 59 } 60 61 public void remove() 62 { 63 throw new UnsupportedOperationException(this.getClass().getName() + " UnsupportedOperationException"); 64 } 65 66 }