| 782 | } |
| 783 | |
| 784 | static Object getFrom(Object coll, Object key){ |
| 785 | if(coll == null) |
| 786 | return null; |
| 787 | else if(coll instanceof Map) { |
| 788 | Map m = (Map) coll; |
| 789 | return m.get(key); |
| 790 | } |
| 791 | else if(coll instanceof IPersistentSet) { |
| 792 | IPersistentSet set = (IPersistentSet) coll; |
| 793 | return set.get(key); |
| 794 | } |
| 795 | else if(key instanceof Number && (coll instanceof String || coll.getClass().isArray())) { |
| 796 | int n = ((Number) key).intValue(); |
| 797 | if(n >= 0 && n < count(coll)) |
| 798 | return nth(coll, n); |
| 799 | return null; |
| 800 | } |
| 801 | else if(coll instanceof ITransientSet) { |
| 802 | ITransientSet set = (ITransientSet) coll; |
| 803 | return set.get(key); |
| 804 | } |
| 805 | |
| 806 | return null; |
| 807 | } |
| 808 | |
| 809 | static public Object get(Object coll, Object key, Object notFound){ |
| 810 | if(coll instanceof ILookup) |