Scan left using supplied Monoid

<pre>
{@code

assertEquals(asList("", "a", "ab", "abc"),
Streams.scanLeft(Stream.of("a", "b", "c"),Reducers.toString(""))
.collect(CyclopsCollectors.toList());

}
</pre>

@param monoid
@return
341357
public final static <T> Stream<T> scanLeft(final Stream<T> stream, final Monoid<T> monoid) {

        final Iterator<T> it = stream.iterator();
        return Streams.stream(new Iterator<T>() {
            boolean init = false;
            T next = monoid.zero();

            @Override
            public boolean hasNext() {
                if (!init)
                    return true;
                return it.hasNext();
            }

            @Override
            public T next() {
                if (!init) {
                    init = true;
                    return monoid.zero();
                }
                return next = monoid
                                    .apply(next, it.next());

            }

        });

    }
687055
public static boolean areEqualTrimmed(final String left, final String right)
   {
      if ((left != null) && (right != null))
      {
         return left.trim().equals(right.trim());
      }
      return areEqual(left, right);
   }
1150295
public boolean isSameType(Monomer m) {
    String analog1 = getNaturalAnalog();
    if (null == analog1) {
      analog1 = getAlternateId();
    }
    String analog2 = m.getNaturalAnalog();
    if (null == analog2) {
      analog2 = m.getAlternateId();
    }
    if (getMonomerType().equals(m.getMonomerType())
        && getPolymerType().equals(m.getPolymerType())
        && analog1.equals(analog2)) {
      return true;
    } else {
      return false;
    }
  }
1195212
static int subSequenceEquals(
        CharSequence test,
        int offset,
        CharSequence expected,
        boolean caseInsensitive,
        boolean rtl
    ) {

        int j = 0;
        int max = test.length();
        int len = expected.length();

        for (int i = 0; i < len; i++) {
            char c = '\u0000';
            char exp = expected.charAt(i);

            if (isBidi(exp)) {
                continue; // always ignore bidis in pattern when parsing
            }

            if (rtl) {
                while ((j + offset < max) && isBidi(c = test.charAt(j + offset))) {
                    j++;
                }
            } else if (j + offset < max) {
                c = test.charAt(j + offset);
            }

            if (j + offset >= max) {
                return -1;
            } else {
                j++;
            }

            if (caseInsensitive) {
                if (!charEqualsIgnoreCase(c, exp)) {
                    return -1;
                }
            } else if (c != exp) {
                return -1;
            }
        }

        if (rtl) {
            while ((j + offset < max) && isBidi(test.charAt(j + offset))) {
                j++;
            }
        }

        return j;

    }
672496
public GroupZipper left() {
        if (!canLeft()) {
            throw new NoSuchElementException("Could not move left because the first node at this level has already been reached");
        }

        index--;
        node = parent.getNode().getGroups().get(index);

        return this;
    }
594780
@Override
    public <U> ListT<W,U> scanRight(final U identity, final BiFunction<? super T, ? super U, ? extends U> combiner) {

        return (ListT<W,U>) FoldableTransformerSeq.super.scanRight(identity, combiner);
    }
188915
public static Boolean and(Object left, Object right) {
        return (Boolean) InfixOpNode.and(left, right, null);
    }
619345
private boolean matches(Collection<Address> left, Collection<Address> right) {
    if (left.size() != right.size())
      return false;

    for (Address address : left) {
      if (!right.contains(address)) {
        return false;
      }
    }
    return true;
  }
1279478
public static boolean isAssignableTo(final String leftType, final String rightType) {
        if (leftType.equals(rightType))
            return true;

        final boolean firstTypeArray = leftType.charAt(0) == '[';
        if (firstTypeArray ^ rightType.charAt(0) == '[') {
            return false;
        }

        final Class<?> leftClass = loadClassFromType(leftType);
        final Class<?> rightClass = loadClassFromType(rightType);
        if (leftClass == null || rightClass == null)
            return false;

        final boolean bothTypesParameterized = hasTypeParameters(leftType) && hasTypeParameters(rightType);
        return rightClass.isAssignableFrom(leftClass) && (firstTypeArray || !bothTypesParameterized || getTypeParameters(leftType).equals(getTypeParameters(rightType)));
    }
170918
public static <A extends Comparable<? super A>> ComparableExpression<A> min(CollectionExpression<?,A> left) {
        return Expressions.comparableOperation((Class) left.getParameter(0), Ops.QuantOps.MIN_IN_COL, (Expression<?>) left);
    }
88543
public Diff compare(String left, String right) {
		return compare(getCtType(left), getCtType(right));
	}
1103231
public void addMonomer(Monomer monomer, boolean dbChanged)
      throws IOException, MonomerException {
    Map<String, Monomer> monomerMap = monomerDB.get(monomer.getPolymerType());
    String polymerType = monomer.getPolymerType();
    String alternateId = monomer.getAlternateId();
    String smilesString = monomer.getCanSMILES();

    try {
      smilesString = SMILES.getUniqueExtendedSMILES(smilesString);
    } catch (Exception e) {
      smilesString = monomer.getCanSMILES();
    }

    boolean hasSmilesString = (smilesString != null && smilesString.length() > 0);

    if (null == monomerMap) {
      monomerMap = new TreeMap<String, Monomer>(String.CASE_INSENSITIVE_ORDER);
      monomerDB.put(polymerType, monomerMap);
    }

    Monomer copyMonomer = DeepCopy.copy(monomer);

    // ensure the canonical SMILES is indexed in the monomer store
    if (hasSmilesString) {
      copyMonomer.setCanSMILES(smilesString);
    }

    boolean alreadyAdded = false;
    alreadyAdded = monomerMap.containsKey(alternateId);

    if (!alreadyAdded) {
      monomerMap.put(alternateId, copyMonomer);

      boolean alreadyInSMILESMap = hasSmilesString
          && (smilesMonomerDB.containsKey(smilesString));

      if (!alreadyInSMILESMap) {
        smilesMonomerDB.put(smilesString, copyMonomer);
      }
    }

    if (dbChanged) {
      MonomerFactory.setDBChanged(true);
    }
  }
997611
@Override
    public ListT<W,T> scanRight(final Monoid<T> monoid) {

        return (ListT<W,T>) FoldableTransformerSeq.super.scanRight(monoid);
    }
672374
public final EqualsToHolder getEquals() throws RecognitionException {
		EqualsToHolder holder = null;


		Token a=null;
		Token b=null;

		try {
			// druidG.g:333:2: ( (a= ID ( WS )? EQUALS ( WS )? b= ( SINGLE_QUOTE_STRING | FLOAT | LONG ) ) )
			// druidG.g:333:4: (a= ID ( WS )? EQUALS ( WS )? b= ( SINGLE_QUOTE_STRING | FLOAT | LONG ) )
			{
			// druidG.g:333:4: (a= ID ( WS )? EQUALS ( WS )? b= ( SINGLE_QUOTE_STRING | FLOAT | LONG ) )
			// druidG.g:333:5: a= ID ( WS )? EQUALS ( WS )? b= ( SINGLE_QUOTE_STRING | FLOAT | LONG )
			{
			a=(Token)match(input,ID,FOLLOW_ID_in_getEquals2187); 
			// druidG.g:333:10: ( WS )?
			int alt140=2;
			int LA140_0 = input.LA(1);
			if ( (LA140_0==WS) ) {
				alt140=1;
			}
			switch (alt140) {
				case 1 :
					// druidG.g:333:10: WS
					{
					match(input,WS,FOLLOW_WS_in_getEquals2189); 
					}
					break;

			}

			match(input,EQUALS,FOLLOW_EQUALS_in_getEquals2192); 
			// druidG.g:333:21: ( WS )?
			int alt141=2;
			int LA141_0 = input.LA(1);
			if ( (LA141_0==WS) ) {
				alt141=1;
			}
			switch (alt141) {
				case 1 :
					// druidG.g:333:21: WS
					{
					match(input,WS,FOLLOW_WS_in_getEquals2194); 
					}
					break;

			}

			b=input.LT(1);
			if ( input.LA(1)==FLOAT||input.LA(1)==LONG||input.LA(1)==SINGLE_QUOTE_STRING ) {
				input.consume();
				state.errorRecovery=false;
			}
			else {
				MismatchedSetException mse = new MismatchedSetException(null,input);
				throw mse;
			}
			}

			holder = new EqualsToHolder((a!=null?a.getText():null), (b!=null?b.getText():null));
			}

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
		}
		return holder;
	}
178797
public static <T extends Tree> Matcher<T> isPrimitiveOrVoidType() {
    return new Matcher<T>() {
      @Override
      public boolean matches(T t, VisitorState state) {
        Type type = getType(t);
        return type != null && type.isPrimitiveOrVoid();
      }
    };
  }
470726
public static boolean isNewerThan(final Version left, final Version right) {

	// major
	if (left.getMajor() > right.getMajor()) return true;
	if (left.getMajor() < right.getMajor()) return false;

	// minor
	if (left.getMinor() > right.getMinor()) return true;
	if (left.getMinor() < right.getMinor()) return false;

	// micro
	if (left.getMicro() > right.getMicro()) return true;
	if (left.getMicro() < right.getMicro()) return false;

	// qualifier
	// left
	String q = left.getQualifier();
	int index = q.indexOf('-');
	String qla = index == -1 ? "" : q.substring(index + 1).trim();
	String qln = index == -1 ? q : q.substring(0, index);
	int ql = isEmpty(qln) ? Integer.MIN_VALUE : Integer.parseInt(qln);

	// right
	q = right.getQualifier();
	index = q.indexOf('-');
	String qra = index == -1 ? "" : q.substring(index + 1).trim();
	String qrn = index == -1 ? q : q.substring(0, index);
	int qr = isEmpty(qln) ? Integer.MIN_VALUE : Integer.parseInt(qrn);

	if (ql > qr) return true;
	if (ql < qr) return false;

	int qlan = qualifierAppendix2Number(qla);
	int qran = qualifierAppendix2Number(qra);

	if (qlan > qran) return true;
	if (qlan < qran) return false;

	if (qlan == QUALIFIER_APPENDIX_OTHER && qran == QUALIFIER_APPENDIX_OTHER) return left.compareTo(right) > 0;

	return false;
    }
66593
private JCExpression scanForAssign(final MethodSymbol sym,
                                       final JCTree tree) {
        class TS extends TreeScanner {
            JCExpression result = null;
            public void scan(JCTree t) {
                if (t != null && result == null)
                    t.accept(this);
            }
            public void visitAnnotation(JCAnnotation t) {
                if (t == tree)
                    scan(t.args);
            }
            public void visitAssign(JCAssign t) {
                if (t.lhs.hasTag(IDENT)) {
                    JCIdent ident = (JCIdent) t.lhs;
                    if (ident.sym == sym)
                        result = t.rhs;
                }
            }
        }
        TS scanner = new TS();
        tree.accept(scanner);
        return scanner.result;
    }