
at.$len Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of at-lang Show documentation
Show all versions of at-lang Show documentation
Basic commands set for the at lang
The newest version!
package at;
import static java.lang.String.valueOf;
import java.util.Iterator;
import org.bitbucket.gkutiel.at.Cmd;
import org.bitbucket.gkutiel.at.Context;
public class $len extends Cmd {
private static int len(final Iterator iterator) {
int len = 0;
while (iterator.hasNext()) {
len++;
iterator.next();
}
return len;
}
@Override public String eval(final Context ctx) {
final Context list = ctx.get(args);
if (list == null) return "0";
return valueOf(len(list.iterator()));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy