MCPcopy Index your code
hub / github.com/clojure/clojure / seqFrom

Method seqFrom

src/jvm/clojure/lang/RT.java:561–579  ·  view source on GitHub ↗
(Object coll)

Source from the content-addressed store, hash-verified

559
560// N.B. canSeq must be kept in sync with this!
561static ISeq seqFrom(Object coll){
562 if(coll instanceof Seqable)
563 return ((Seqable) coll).seq();
564 else if(coll == null)
565 return null;
566 else if(coll instanceof Iterable)
567 return chunkIteratorSeq(((Iterable) coll).iterator());
568 else if(coll.getClass().isArray())
569 return ArraySeq.createFromObject(coll);
570 else if(coll instanceof CharSequence)
571 return StringSeq.create((CharSequence) coll);
572 else if(coll instanceof Map)
573 return seq(((Map) coll).entrySet());
574 else {
575 Class c = coll.getClass();
576 Class sc = c.getSuperclass();
577 throw new IllegalArgumentException("Don't know how to create ISeq from: " + c.getName());
578 }
579}
580
581static public boolean canSeq(Object coll){
582 return coll instanceof ISeq

Callers 1

seqMethod · 0.95

Calls 8

chunkIteratorSeqMethod · 0.95
createFromObjectMethod · 0.95
createMethod · 0.95
seqMethod · 0.95
seqMethod · 0.65
iteratorMethod · 0.65
getNameMethod · 0.65
entrySetMethod · 0.45

Tested by

no test coverage detected