equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
32 |
32 |
33 package com.sun.tools.hat.internal.util; |
33 package com.sun.tools.hat.internal.util; |
34 |
34 |
35 import java.util.Enumeration; |
35 import java.util.Enumeration; |
36 import java.util.NoSuchElementException; |
36 import java.util.NoSuchElementException; |
|
37 import com.sun.tools.hat.internal.model.JavaHeapObject; |
37 |
38 |
38 public class CompositeEnumeration implements Enumeration { |
39 public class CompositeEnumeration implements Enumeration<JavaHeapObject> { |
39 Enumeration e1; |
40 Enumeration<JavaHeapObject> e1; |
40 Enumeration e2; |
41 Enumeration<JavaHeapObject> e2; |
41 |
42 |
42 public CompositeEnumeration(Enumeration e1, Enumeration e2) { |
43 public CompositeEnumeration(Enumeration<JavaHeapObject> e1, Enumeration<JavaHeapObject> e2) { |
43 this.e1 = e1; |
44 this.e1 = e1; |
44 this.e2 = e2; |
45 this.e2 = e2; |
45 } |
46 } |
46 |
47 |
47 public boolean hasMoreElements() { |
48 public boolean hasMoreElements() { |
48 return e1.hasMoreElements() || e2.hasMoreElements(); |
49 return e1.hasMoreElements() || e2.hasMoreElements(); |
49 } |
50 } |
50 |
51 |
51 public Object nextElement() { |
52 public JavaHeapObject nextElement() { |
52 if (e1.hasMoreElements()) { |
53 if (e1.hasMoreElements()) { |
53 return e1.nextElement(); |
54 return e1.nextElement(); |
54 } |
55 } |
55 |
56 |
56 if (e2.hasMoreElements()) { |
57 if (e2.hasMoreElements()) { |