Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Iterator and Iterable interfaces on InternalTypeEnumeration #113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

import proguard.classfile.*;

import java.util.Iterator;

/**
* An {@link InternalTypeEnumeration} provides an enumeration of all
* types listed in a given internal descriptor or signature of a class, a
Expand All @@ -31,6 +33,8 @@
* @author Eric Lafortune
*/
public class InternalTypeEnumeration
implements Iterator<String>,
Iterable<String>
{
private final String descriptor;
private final int formalTypeParametersIndex;
Expand Down Expand Up @@ -271,6 +275,29 @@ private void skipGeneric()
}


// Implementations for Iterator.
@Override
public boolean hasNext()
{
return hasMoreTypes();
}


@Override
public String next()
{
return nextType();
}


// Implementations for Iterable.
@Override
public Iterator<String> iterator()
{
return this;
}


/**
* A main method for testing the type enumeration.
*/
Expand Down
Loading