For the given {@link Sequence} this will return a {@link List} filled with
the Compounds of that {@link Sequence}.
488052
public static <C extends Compound> List<C> toList(Sequence<C> sequence) {
		List<C> list = new ArrayList<C>(sequence.getLength());
		for (C compound : sequence) {
			list.add(compound);
		}
		return list;
	}
1171769
public Sequence getSequence(String sequenceKey, SequenceConfig sequenceConfig) {
        Sequence sequence = sequences.get(checkNotNull(sequenceKey));
        if (null == sequence) {
            sequence = sequenceDB().openSequence(null, 
                    sequenceDB().getEntry(sequenceKey), firstNonNull(sequenceConfig, defaultSequenceConfig()));
            sequences.put(sequenceKey, sequence);
        }
        
        return sequence;
    }
326198
@Override
    public Object mapSequence(Object sequence) {
        List<List<Float>> seq = (List<List<Float>>) sequence;
        List<Float> ret = new ArrayList<>();
        for (List<Float> step : seq)
            ret.add((Float) map(step));
        return ret;
    }
884436
private void addSequences(Iterable<Sequence> sequences) {
		Transaction tx = null;
		try {
			tx = neo4jDb.beginTx();
			for ( Sequence sequence : sequences ) {
				addSequence( sequence );
			}
			tx.success();
		}
		finally {
			tx.close();
		}
	}
286439
public static ProteinSequence convertDNAtoProteinSequence(String dnaSequence) throws CompoundNotFoundException {
		DNASequence dna = new DNASequence(dnaSequence);
		return convertDNAtoProteinSequence(dna);
	}
664605
public static int getBondCount(IChemSequence sequence) {
        int count = 0;
        for (int i = 0; i < sequence.getChemModelCount(); i++) {
            count += ChemModelManipulator.getBondCount(sequence.getChemModel(i));
        }
        return count;
    }
1042591
public static <T> Sequence<T> sort(final Sequence<T> sequence, final Comparator<T> comparator)
  {
    List<T> seqList = Sequences.toList(sequence, Lists.<T>newArrayList());
    Collections.sort(seqList, comparator);
    return BaseSequence.simple(seqList);
  }
209536
@Nonnull
  public List<E> toList() {
    return new AbstractList<E>() {
      @Override
      public E get(final int index) {
        return Seq.this.get(index);
      }

      @Override
      public int size() {
        return length();
      }
    };
  }
1167657
public final List<SequenceLabel> getSequencesFromSpans(final String[] tokens,
      final Span[] seqSpans) {
    final List<SequenceLabel> sequences = new ArrayList<SequenceLabel>();
    for (final Span seqSpan : seqSpans) {
      final String seqString = seqSpan.getCoveredText(tokens);
      final String seqType = seqSpan.getType();
      final SequenceLabel sequence = this.sequenceFactory
          .createSequence(seqString, seqType, seqSpan);
      sequences.add(sequence);
    }
    return sequences;
  }
94140
@SafeVarargs
    public static <T> Iterable<T> sequence( final Iterable<? extends T>... iterables ) {
        return new Iterable<T>() {
            public Iterator<T> iterator() {
                return new FlattenIterator<T,Iterable<? extends T>>(ImmutableList.copyOf(iterables)) {
                    protected Iterator<T> expand(Iterable<? extends T> iterable) {
                        return Iterators.<T>cast(iterable).iterator();
                    }
                };
            }
        };
    }
914112
protected <C extends Compound> boolean canComplement(Sequence<C> sequence) {
		CompoundSet<C> compoundSet = sequence.getCompoundSet();
		Compound c = compoundSet.getAllCompounds().iterator().next();
		return ComplementCompound.class.isAssignableFrom(c.getClass());
	}
195926
@Override
    public Iterable<IChemSequence> chemSequences() {
        return new Iterable<IChemSequence>() {

            @Override
            public Iterator<IChemSequence> iterator() {
                return new ChemSequenceIterator();
            }
        };
    }
1226058
@Override
    public Object mapSequence(Object sequence) {
        List<?> list = (List<?>) sequence;
        List<Object> ret = new ArrayList<>();
        for (Object o : list)
            ret.add(map(o));
        return ret;
    }
98687
public static <C extends Compound> int lastIndexOf(Sequence<C> sequence,
			C compound) {
		int index = indexOf(new ReversedSequenceView<C>(sequence), compound);
		return (sequence.getLength() - index)+1;
	}
1006471
@Override
	public List<C> getCompoundsAt(int alignmentIndex) {
		List<C> column = new ArrayList<C>();
		for (S s : sequences) {
			column.add(s.getCompoundAt(alignmentIndex));
		}
		return Collections.unmodifiableList(column);
	}
1295567
public static <S extends Seq<S>> S concatenate(S... sequences) {
        if (sequences.length == 0)
            throw new IllegalArgumentException("Zero arguments");

        if (sequences.length == 1)
            return sequences[0];

        int size = 0;
        for (S s : sequences)
            size += s.size();

        SeqBuilder<S> builder = sequences[0].getBuilder().ensureCapacity(size);

        for (S s : sequences)
            builder.append(s);

        return builder.createAndDestroy();
    }
178997
public static int[] sequence(int start, int end) {
    if(start >= end) {
      return EMPTY_INTS;
    }
    int[] ret = new int[end - start];
    for(int j = 0; start < end; start++, j++) {
      ret[j] = start;
    }
    return ret;
  }