com.github.basking2.sdsai.itrex.functions.StringJoinFunction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sdsai-itrex Show documentation
Show all versions of sdsai-itrex Show documentation
An S-Expression inspiried library focused on iterators.
package com.github.basking2.sdsai.itrex.functions;
import com.github.basking2.sdsai.itrex.EvaluationContext;
import java.util.Iterator;
public class StringJoinFunction implements FunctionInterface {
@Override
public String apply(final Iterator> iterator, final EvaluationContext evaluationContext) {
if (!iterator.hasNext()) {
return "";
}
final String s = iterator.next().toString();
final StringBuilder sb = new StringBuilder();
while (iterator.hasNext()) {
final Object o = iterator.next();
if (o instanceof Iterator) {
@SuppressWarnings("unchecked")
final Iterator
© 2015 - 2024 Weber Informatics LLC | Privacy Policy