jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cla...@apache.org
Subject [26/50] [abbrv] jena git commit: Further simplification in jena-base
Date Sun, 10 May 2015 13:03:55 GMT
Further simplification in jena-base


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/a664cb6c
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/a664cb6c
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/a664cb6c

Branch: refs/heads/add-contract-tests
Commit: a664cb6cf9f98a20bee3d37f7df869cfb06950bd
Parents: 6b47534
Author: ajs6f <ajs6f@virginia.edu>
Authored: Mon May 4 15:15:23 2015 -0400
Committer: ajs6f <ajs6f@virginia.edu>
Committed: Mon May 4 19:49:52 2015 -0400

----------------------------------------------------------------------
 .../sparql/engine/iterator/QueryIterGroup.java  |  22 +-
 .../sparql/engine/iterator/QueryIterTopN.java   |   8 +-
 .../org/apache/jena/sparql/util/Context.java    |   2 +-
 .../org/apache/jena/atlas/iterator/Iter.java    |  22 +-
 .../jena/atlas/iterator/IteratorArray.java      |   3 +-
 .../org/apache/jena/atlas/lib/Allocator.java    |  28 ---
 .../org/apache/jena/atlas/lib/Callback.java     |   5 +-
 .../java/org/apache/jena/atlas/lib/Cell.java    |  99 ---------
 .../apache/jena/atlas/lib/CollectionUtils.java  |   9 +-
 .../java/org/apache/jena/atlas/lib/FileOps.java |  18 +-
 .../org/apache/jena/atlas/lib/ListUtils.java    |  65 ++----
 .../org/apache/jena/atlas/lib/MultiMap.java     | 146 -------------
 .../apache/jena/atlas/lib/MultiMapToList.java   |  43 ----
 .../apache/jena/atlas/lib/MultiMapToSet.java    |  47 ----
 .../org/apache/jena/atlas/lib/MultiSet.java     | 218 -------------------
 .../apache/jena/atlas/lib/PropertyUtils.java    |   4 +-
 .../org/apache/jena/atlas/lib/StrUtils.java     |  41 +---
 .../java/org/apache/jena/atlas/lib/Tuple.java   |   8 +-
 .../org/apache/jena/atlas/lib/TupleBuilder.java |  50 -----
 .../org/apache/jena/atlas/lib/cache/Getter.java |  25 ---
 .../java/org/apache/jena/atlas/lib/TS_Lib.java  |   1 -
 .../org/apache/jena/atlas/lib/TestMultiSet.java | 143 ------------
 .../impl/PropertyTableHashMapImpl.java          |  19 +-
 .../java/org/apache/jena/fuseki/FusekiLib.java  |   8 +-
 .../jena/fuseki/servlets/SPARQL_Protocol.java   |   4 +-
 .../java/org/apache/jena/fuseki/FusekiLib.java  |   8 +-
 .../apache/jena/fuseki/server/DataService.java  |   6 +-
 .../jena/fuseki/servlets/SPARQL_Protocol.java   |   2 +-
 .../jena/tdb/base/block/BlockMgrTracker.java    |  31 +--
 .../jena/query/text/EntityDefinition.java       |   5 +-
 .../assembler/EntityDefinitionAssembler.java    |  19 +-
 31 files changed, 112 insertions(+), 997 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterGroup.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterGroup.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterGroup.java
index e483c58..2b2e194 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterGroup.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterGroup.java
@@ -25,8 +25,10 @@ import java.util.List ;
 
 import org.apache.jena.atlas.iterator.Iter ;
 import org.apache.jena.atlas.iterator.IteratorDelayedInitialization ;
-import org.apache.jena.atlas.lib.MultiMap ;
 import org.apache.jena.atlas.lib.Pair ;
+import org.apache.jena.ext.com.google.common.collect.ArrayListMultimap;
+import org.apache.jena.ext.com.google.common.collect.HashMultimap;
+import org.apache.jena.ext.com.google.common.collect.Multimap;
 import org.apache.jena.graph.Node ;
 import org.apache.jena.sparql.core.Var ;
 import org.apache.jena.sparql.core.VarExprList ;
@@ -77,12 +79,12 @@ public class QueryIterGroup extends QueryIterPlainWrapper
             @Override
             protected Iterator<Binding> initializeIterator() {
 
-                boolean noAggregators =  ( aggregators == null || aggregators.size() == 0 ) ;
+                boolean noAggregators =  ( aggregators == null || aggregators.isEmpty() ) ;
                 
-                // Phase 1 : assign bindings to buckets by key and pump through the aggregrators.
-                MultiMap<Binding, Pair<Var, Accumulator>> accumulators = MultiMap.createMapList() ;
+                // Phase 1 : assign bindings to buckets by key and pump through the aggregators.
+                Multimap<Binding, Pair<Var, Accumulator>> accumulators = HashMultimap.create() ;
 
-                for ( ; iter.hasNext() ; )
+                while ( iter.hasNext() )
                 {
                     Binding b = iter.nextBinding() ;
                     Binding key = genKey(groupVarExpr, b, execCxt) ;
@@ -94,9 +96,8 @@ public class QueryIterGroup extends QueryIterPlainWrapper
                         continue ;
                     }
 
-                    Collection<Pair<Var, Accumulator>> accs = accumulators.get(key) ;
                     // Create if does not exist.
-                    if ( accs == null )
+                    if ( !accumulators.containsKey(key) )
                     {
                         for ( ExprAggregator agg : aggregators )
                         {
@@ -104,11 +105,10 @@ public class QueryIterGroup extends QueryIterPlainWrapper
                             Var v = agg.getVar() ;
                             accumulators.put(key, Pair.create(v, x)) ;
                         }
-                        accs = accumulators.get(key) ;
                     }
 
                     // Do the per-accumulator calculation.
-                    for ( Pair<Var, Accumulator> pair : accs )
+                    for ( Pair<Var, Accumulator> pair : accumulators.get(key) )
                         pair.getRight().accumulate(b, execCxt) ;
                 }
 
@@ -153,11 +153,11 @@ public class QueryIterGroup extends QueryIterPlainWrapper
                 
                 if ( noAggregators )
                     // We used placeholder so there are always the key. 
-                    return accumulators.keys().iterator() ;
+                    return accumulators.keySet().iterator() ;
                 
                 List<Binding> results = new ArrayList<>() ;
 
-                for ( Binding k : accumulators.keys() )
+                for ( Binding k : accumulators.keySet() )
                 {
                     Collection<Pair<Var, Accumulator>> accs = accumulators.get(k) ;
                     BindingMap b = BindingFactory.create(k) ;

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterTopN.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterTopN.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterTopN.java
index 266fd1a..f5a39a9 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterTopN.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterTopN.java
@@ -18,6 +18,8 @@
 
 package org.apache.jena.sparql.engine.iterator;
 
+import static java.util.Arrays.asList;
+
 import java.util.Arrays ;
 import java.util.Comparator ;
 import java.util.Iterator ;
@@ -25,7 +27,6 @@ import java.util.List ;
 import java.util.PriorityQueue ;
 
 import org.apache.jena.atlas.iterator.Iter ;
-import org.apache.jena.atlas.iterator.IteratorArray ;
 import org.apache.jena.atlas.iterator.IteratorDelayedInitialization ;
 import org.apache.jena.atlas.lib.ReverseComparator ;
 import org.apache.jena.query.Query ;
@@ -87,7 +88,7 @@ public class QueryIterTopN extends QueryIterPlainWrapper
         return new IteratorDelayedInitialization<Binding>() {
             @Override
             protected Iterator<Binding> initializeIterator() {
-                for (; qIter.hasNext();) {
+                while ( qIter.hasNext() ) {
                     Binding binding = qIter.next() ;
                     if ( heap.size() < limit )
                         add(binding) ;
@@ -101,8 +102,7 @@ public class QueryIterTopN extends QueryIterPlainWrapper
                 Binding[] y = heap.toArray(new Binding[]{}) ;
                 heap = null ;
                 Arrays.sort(y, comparator) ;
-                IteratorArray<Binding> iter = IteratorArray.create(y) ;
-                return iter ;
+                return asList(y).iterator() ;
             }
         } ;
     }

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-arq/src/main/java/org/apache/jena/sparql/util/Context.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/util/Context.java b/jena-arq/src/main/java/org/apache/jena/sparql/util/Context.java
index 9107dea..f8c8ed9 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/util/Context.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/util/Context.java
@@ -273,7 +273,7 @@ public class Context
     {
         for ( Callback<Symbol> c : callbacks )
         {
-            c.proc(symbol) ;
+            c.apply(symbol) ;
         }
     }
     

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-base/src/main/java/org/apache/jena/atlas/iterator/Iter.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/iterator/Iter.java b/jena-base/src/main/java/org/apache/jena/atlas/iterator/Iter.java
index fc0a534..9cf45a7 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/iterator/Iter.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/iterator/Iter.java
@@ -267,7 +267,7 @@ public class Iter<T> implements Iterator<T> {
      * stream until the first element not passing the filter)
      */
     public static <T> boolean every(Iterator<? extends T> stream, Predicate<T> filter) {
-        for (; stream.hasNext();) {
+        while ( stream.hasNext() ) {
             T item = stream.next() ;
             if ( !filter.test(item) )
                 return false ;
@@ -291,7 +291,7 @@ public class Iter<T> implements Iterator<T> {
      * the stream to first element passing the filter)
      */
     public static <T> boolean some(Iterator<? extends T> stream, Predicate<T> filter) {
-        for (; stream.hasNext();) {
+        while ( stream.hasNext() ) {
             T item = stream.next() ;
             if ( filter.test(item) )
                 return true ;
@@ -420,14 +420,14 @@ public class Iter<T> implements Iterator<T> {
 //    }
 
     public static <T> Iterator<T> removeNulls(Iterator<T> iter) {
-        return filter(iter, x -> x != null) ;
+        return filter(iter, Objects::nonNull) ;
     }
 
     /** Take the first N elements of an iterator - stop early if too few */
     public static <T> List<T> take(Iterator<T> iter, int N) {
         iter = new IteratorN<>(iter, N) ;
         List<T> x = new ArrayList<>(N) ;
-        for (; iter.hasNext();)
+        while ( iter.hasNext() )
             x.add(iter.next()) ;
         return x ;
     }
@@ -611,7 +611,7 @@ public class Iter<T> implements Iterator<T> {
 
     /** Send the elements of the iterator to a sink - consumes the iterator */
     public static <T> void sendToSink(Iterator<T> iter, Sink<T> sink) {
-        for (; iter.hasNext();) {
+        while ( iter.hasNext() ) {
             T thing = iter.next() ;
             sink.send(thing) ;
         }
@@ -635,11 +635,11 @@ public class Iter<T> implements Iterator<T> {
     // { return Iter.iter(Arrays.asList(objects)) ; }
 
     public static <T> Iter<T> iterSingleton(T x) {
-        return Iter.iter(SingletonIterator.create(x)) ;
+        return iter(SingletonIterator.create(x)) ;
     }
 
     public static <T> Iter<T> iter(Collection<T> collection) {
-        return Iter.iter(collection.iterator()) ;
+        return iter(collection.iterator()) ;
     }
 
     public static <T> Iter<T> iter(Iterator<T> iterator) {
@@ -667,7 +667,7 @@ public class Iter<T> implements Iterator<T> {
      * debugging
      */
     public static <T> Iterator<T> materialize(Iterator<T> iter) {
-        return Iter.toList(iter).iterator() ;
+        return toList(iter).iterator() ;
     }
 
     public static <T> Iter<T> concat(Iter<T> iter1, Iter<T> iter2) {
@@ -683,7 +683,7 @@ public class Iter<T> implements Iterator<T> {
             return iter2 ;
         if ( iter2 == null )
             return iter1 ;
-        return Iter.iter(iter1).append(Iter.iter(iter2)) ;
+        return iter(iter1).append(iter(iter2)) ;
     }
 
     public static <T> T first(Iterator<T> iter, Predicate<T> filter) {
@@ -790,7 +790,7 @@ public class Iter<T> implements Iterator<T> {
     }
 
     public Iter<T> removeNulls() {
-        return filter(x -> x != null) ;
+        return iter(removeNulls(this)) ;
     }
 
     public <R> Iter<R> map(Function<T, R> converter) {
@@ -823,7 +823,7 @@ public class Iter<T> implements Iterator<T> {
 
     /** Return an Iter that yields at most the first N items */
     public Iter<T> take(int N) {
-        return Iter.iter(take(iterator, N)) ;
+        return iter(take(iterator, N)) ;
     }
 
     /** Count the iterator (this is destructive on the iterator) */

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-base/src/main/java/org/apache/jena/atlas/iterator/IteratorArray.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/iterator/IteratorArray.java b/jena-base/src/main/java/org/apache/jena/atlas/iterator/IteratorArray.java
index a8cb1b2..70a8f26 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/iterator/IteratorArray.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/iterator/IteratorArray.java
@@ -25,7 +25,8 @@ import java.util.Spliterator;
 
 /** Iterator over a Java base array */
 /**
- * Prefer {@link Arrays#spliterator(Object[])} or {@link Arrays#stream(Object[])}
+ * Prefer {@link Arrays#asList(Object...)} with {@link Iterable#iterator()} or
+ * {@link Arrays#spliterator(Object[])} or {@link Arrays#stream(Object[])}
  */
 @Deprecated
 public final class IteratorArray<T> implements Iterator<T>

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-base/src/main/java/org/apache/jena/atlas/lib/Allocator.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/Allocator.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/Allocator.java
deleted file mode 100644
index 84005de..0000000
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/Allocator.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.atlas.lib;
-
-public interface Allocator<T>
-{
-    /** Allocate a new T, different from others allocated */ 
-    public T create() ;
-    
-//    /** Reset the process of allocation - may cause equivalent objects to be created from before the reset */  
-//    public void reset() ;
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-base/src/main/java/org/apache/jena/atlas/lib/Callback.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/Callback.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/Callback.java
index d2f04f9..647625a 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/Callback.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/lib/Callback.java
@@ -18,7 +18,8 @@
 
 package org.apache.jena.atlas.lib;
 
-public interface Callback<T>
+import java.util.function.Function;
+
+public interface Callback<T> extends Function<T, Void>
 {
-    public void proc(T arg) ;
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-base/src/main/java/org/apache/jena/atlas/lib/Cell.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/Cell.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/Cell.java
deleted file mode 100644
index 6910c0c..0000000
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/Cell.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.atlas.lib ;
-
-
-/** Key-value slot, with chaining for lookup. */  
-public class Cell<K,V>
-{
-    private final Cell<K,V> previous ;
-    private final K key ;
-    private final V value ;
-
-    /** Create a slot with no key, value or parent - can be used a slot chain root */  
-    public Cell()               { this(null, null, null); }
-
-    public Cell(K key, V value) { this(key, value, null); }
-
-    private Cell(K key, V value, Cell<K, V> previous)
-    {
-        this.key = key ;
-        this.value = value ;
-        this.previous = previous ;
-    }
-
-    public Cell<K,V> extend(K key, V value)
-    {
-        return new Cell<>(key, value, this) ;
-    }
-    
-    public final V find(K k)
-    {
-        // Java, tail recursion, lack thereof.
-        Cell<K,V> slot = this ;
-
-        while (slot != null)
-        {
-            // Defend against null keys (e.g. the root of a slot chain). 
-            if ( k.equals(slot.key) )
-                return slot.value ;
-//            if ( previous == null )
-//              return null ;
-            slot = slot.previous ;
-        }
-        return null ;
-    }
-    
-      /* As it should be ... */
-//    public final V find(K k)
-//    {
-//        if ( k.equals(key) )
-//            return value ;
-//        if ( previous == null )
-//            return null ;
-//        return previous.find(k) ;
-//    }
-
-    private static final String sep = ", " ;
-    private void str(int level, StringBuilder acc)
-    {
-        if ( key == null && value == null )
-            return ;
-
-        if ( level != 0 )
-            acc.append(sep) ;
-        acc.append("(") ;
-        acc.append(key.toString()) ;
-        acc.append("->") ;
-        acc.append(value.toString()) ;
-        acc.append(")") ;
-        if ( previous != null )
-            previous.str(level+1, acc) ;
-    }
-
-    @Override
-    public String toString()
-    { 
-        StringBuilder sb = new StringBuilder() ;
-        sb.append("{ ") ;
-        str(0, sb) ;
-        sb.append(" }") ;
-        return sb.toString() ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-base/src/main/java/org/apache/jena/atlas/lib/CollectionUtils.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/CollectionUtils.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/CollectionUtils.java
index 759e543..9895df8 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/CollectionUtils.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/lib/CollectionUtils.java
@@ -19,16 +19,11 @@
 package org.apache.jena.atlas.lib;
 
 import java.util.Collection ;
-import java.util.Objects;
 
 public class CollectionUtils
-{
-    static public <T> void removeNulls(Collection<T> list)
-    {	
-    		list.removeIf(Objects::isNull);
-    }
-    
+{   
     static public <T> boolean disjoint(Collection<T> c1, Collection<T> c2)
     {
 		return c1.stream().noneMatch(c2::contains);
+    }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-base/src/main/java/org/apache/jena/atlas/lib/FileOps.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/FileOps.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/FileOps.java
index 6862f4a..cf2e6ee 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/FileOps.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/lib/FileOps.java
@@ -19,11 +19,8 @@
 package org.apache.jena.atlas.lib ;
 
 import java.io.File ;
-import java.io.FileInputStream ;
-import java.io.FileOutputStream ;
 import java.io.IOException ;
-import java.nio.channels.FileChannel ;
-
+import java.nio.file.Files;
 import org.apache.jena.atlas.AtlasException ;
 import org.apache.jena.atlas.io.IO ;
 import org.apache.jena.atlas.logging.Log ;
@@ -83,9 +80,8 @@ public class FileOps {
         if ( ! d.exists() )
             return ;
         
-        for ( File f : d.listFiles() ) {
-            if ( ".".equals(f.getName()) || "..".equals(f.getName()) )
-                continue ;
+		for (File f : d.listFiles(f -> !f.getName().equals(".")
+				&& !f.getName().equals(".."))) {
             if ( f.isDirectory() )
                 clearAll(f) ;
             f.delete() ;
@@ -215,13 +211,7 @@ public class FileOps {
     /** Copy a file */
     public static void copyFile(File source, File dest) {
         try {
-            @SuppressWarnings("resource")
-            FileChannel sourceChannel = new FileInputStream(source).getChannel() ;
-            @SuppressWarnings("resource")
-            FileChannel destChannel = new FileOutputStream(dest).getChannel() ;
-            destChannel.transferFrom(sourceChannel, 0, sourceChannel.size()) ;
-            sourceChannel.close() ;
-            destChannel.close() ;
+        		Files.copy(source.toPath(), dest.toPath());
         }
         catch (IOException ex) {
             IO.exception(ex) ;

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-base/src/main/java/org/apache/jena/atlas/lib/ListUtils.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/ListUtils.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/ListUtils.java
index 8315236..2d1345f 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/ListUtils.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/lib/ListUtils.java
@@ -18,13 +18,13 @@
 
 package org.apache.jena.atlas.lib;
 
+import static java.util.Arrays.stream;
+import static java.util.stream.Collectors.joining;
+import static java.util.stream.Collectors.toList;
+
 import java.util.ArrayList ;
 import java.util.List ;
-import java.util.function.Consumer;
-
 import org.apache.jena.atlas.io.IndentedWriter ;
-import org.apache.jena.atlas.iterator.FilterUnique ;
-import org.apache.jena.atlas.iterator.Iter ;
 import org.apache.jena.atlas.logging.Log ;
 
 /** Various things for lists */
@@ -35,14 +35,13 @@ public class ListUtils
     public static <T>
     List<T> unique(List<T> list)
     {
-        Iter<T> iter = Iter.iter(list.iterator()) ;
-        return iter.filter(new FilterUnique<T>()).toList() ;
+    		return list.stream().distinct().collect(toList());
     }
     
     public static
     List<Integer> asList(int... values)
     {
-        List<Integer> x = new ArrayList<>() ;
+        List<Integer> x = new ArrayList<>(values.length) ;
         for ( int v : values )
             x.add(v) ;
         return x ;
@@ -50,47 +49,17 @@ public class ListUtils
     
     public static <T> String str(T[] array)
     {
-        StringBuilder buff = new StringBuilder() ;
-        String sep = "[" ;
-
-        for ( T anArray : array )
-        {
-            buff.append( sep );
-            sep = ", ";
-            buff.append( anArray );
-        }
-        buff.append("]") ;
-        return buff.toString() ;
+        return stream(array).map(String::valueOf).collect(joining(", ", "[", "]"));
     }
     
     public static String str(int[] array)
     {
-        StringBuilder buff = new StringBuilder() ;
-        String sep = "[" ;
-
-        for ( int anArray : array )
-        {
-            buff.append( sep );
-            sep = ", ";
-            buff.append( anArray );
-        }
-        buff.append("]") ;
-        return buff.toString() ;
+    		return stream(array).mapToObj(String::valueOf).collect(joining(", ", "[", "]"));
     }
     
     public static String str(long[] array)
     {
-        StringBuilder buff = new StringBuilder() ;
-        String sep = "[" ;
-
-        for ( long anArray : array )
-        {
-            buff.append( sep );
-            sep = ", ";
-            buff.append( anArray );
-        }
-        buff.append("]") ;
-        return buff.toString() ;
+    		return stream(array).mapToObj(String::valueOf).collect(joining(", ", "[", "]"));
     }
 
     public static <T> void print(IndentedWriter out, List<T> list)
@@ -98,23 +67,15 @@ public class ListUtils
         print(out, list, " ") ;
     }
     
-    public static <T> void print(final IndentedWriter out, List<T> list, final String sep)
+    public static <T> void print(final IndentedWriter out, List<T> list, final CharSequence sep)
     {
-        Consumer<T> output = new Consumer<T>() {
-            boolean first = true ;
-            @Override
-            public void accept(T item)
-            {
-                if ( ! first ) out.print(sep) ;
-                out.print(item.toString()) ;
-                first = false ;
-            }
-        } ;
-        Iter.apply(list.iterator(), output) ;
+		out.print(list.stream().map(String::valueOf).collect(joining(sep)));
     }
     
     /** Return a list of lists of all the elements of collection in every order
      *  Easy to run out of heap memory.
+     *  
+     *  See {@link com.google.common.collect.Collections2#permutations(Collection<E>)}
      */  
     static public <T> List<List<T>> permute(List<T> c)
     {

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-base/src/main/java/org/apache/jena/atlas/lib/MultiMap.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/MultiMap.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/MultiMap.java
deleted file mode 100644
index 2782ea6..0000000
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/MultiMap.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.atlas.lib;
-
-import java.util.* ;
-
-import org.apache.jena.atlas.iterator.IteratorConcat ;
-
-/* Map from K to collection of V */
-
-public abstract class MultiMap<K, V>
-{
-    private Map<K, Collection<V>> map = new HashMap<>() ;
-
-    protected abstract Collection<V> createCollection() ;
-    
-    public static <K, V> MultiMapToList<K, V> createMapList() { return new MultiMapToList<>() ; }
-    public static <K, V> MultiMapToSet<K, V> createMapSet() { return new MultiMapToSet<>() ; }
-    
-    protected MultiMap() { }
-    
-    protected Collection<V> getByKey(K key) { 
-        return map.get(key) ; 
-    } 
-
-    public abstract Collection<V> get(K key) ; 
-    
-    public V getOne(K key) { 
-        Collection<V> c = map.get(key) ;
-        if ( c == null || c.size() == 0 ) 
-            return null ;
-        return c.iterator().next() ;
-    }
-    
-    public void putAll(K key, @SuppressWarnings("unchecked") V ... values)
-    {
-        for ( V v : values)
-            put(key, v) ;
-    }
-    
-    public void put(K key, V value)
-    { 
-        Collection<V> x = map.get(key) ;
-        if ( x == null )
-        {
-            x = createCollection() ;
-            map.put(key, x) ;
-        }
-        x.add(value) ;
-    }
-    
-    public void remove(K key, V value)  {
-        if ( map.containsKey(key))
-            map.get(key).remove(value) ;
-    }
-    public void removeKey(K key)        { map.remove(key) ; }
-    
-    protected Collection<V> valuesForKey(K key) { return map.get(key); }
-    public abstract Collection<V> values(K key) ;
-    public abstract Collection<V> values() ;
-
-    public boolean containsKey(K key) { return map.containsKey(key) ; }
-    
-    public Set<K> keys()        { return map.keySet() ; }
-    
-    public void clear()         { map.clear() ; }
-    
-    public boolean isEmpty()    { return map.isEmpty() ; }
-
-    /** Does not materialise the contents */
-    public Iterator<V> flatten()
-    {
-        IteratorConcat<V> all = new IteratorConcat<>() ;
-        for ( K k : map.keySet() )        
-        {
-            Collection<V> x =  map.get(k) ;
-            all.add(x.iterator()) ;
-        }
-        return all ;
-    }
-    
-    @Override
-    public boolean equals(Object obj) {
-        if ( this == obj )
-            return true ;
-        if ( obj == null )
-            return false ;
-        if ( getClass() != obj.getClass() )
-            return false ;
-        MultiMap<?,?> other = (MultiMap<?,?>)obj ;
-        if ( map == null ) {
-            if ( other.map != null )
-                return false ;
-        } else if ( !map.equals(other.map) )
-            return false ;
-        return true ;
-    }
-    
-    @Override
-    public int hashCode()       { return map.hashCode()^ 0x01010101 ; }
-    
-    @Override
-    public String toString()
-    {
-        StringBuilder sb = new StringBuilder() ;
-        sb.append("{ ") ;
-        boolean firstKey = true ;
-        for ( K key : keys() )
-        {
-            if ( ! firstKey )
-                sb.append(", ") ;
-            firstKey = false ;
-            sb.append(key) ;
-            sb.append(" => [") ;
-            boolean firstValue = true ; 
-            for ( V value : values(key) )
-            {
-                if ( firstValue )
-                    sb.append(" ") ;
-                else
-                    sb.append(", ") ;
-                sb.append(value) ;
-                firstValue = false ;
-            }
-            sb.append(" ] ") ;
-        }
-        sb.append("}") ;
-        return sb.toString() ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-base/src/main/java/org/apache/jena/atlas/lib/MultiMapToList.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/MultiMapToList.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/MultiMapToList.java
deleted file mode 100644
index ac1ba70..0000000
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/MultiMapToList.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.atlas.lib;
-
-import java.util.ArrayList ;
-import java.util.Collection ;
-import java.util.List ;
-
-import org.apache.jena.atlas.iterator.Iter ;
-
-public class MultiMapToList<K,V> extends MultiMap<K,V> {
-    public static <K, V> MultiMapToList<K, V> create() { return new MultiMapToList<>() ; }
-    
-    @Override
-    protected Collection<V> createCollection() {
-        return new ArrayList<>() ;
-    }
-    
-    @Override
-    public List<V> get(K key) { return (List<V>)getByKey(key); }
-    
-    @Override
-    public List<V> values(K key) { return (List<V>)valuesForKey(key); }
-    
-    @Override
-    public List<V> values() { return Iter.toList(flatten()) ; }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-base/src/main/java/org/apache/jena/atlas/lib/MultiMapToSet.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/MultiMapToSet.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/MultiMapToSet.java
deleted file mode 100644
index b89e05b..0000000
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/MultiMapToSet.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.atlas.lib;
-
-import java.util.Collection ;
-import java.util.HashSet ;
-import java.util.Set ;
-
-import org.apache.jena.atlas.iterator.Iter ;
-
-public class MultiMapToSet<K,V> extends MultiMap<K,V> {
-    public static <K, V> MultiMapToSet<K, V> create() { return new MultiMapToSet<>() ; }
-    
-    @Override
-    protected Collection<V> createCollection()
-    {
-        return new HashSet<>() ;
-    }
-    
-    @Override
-    public Set<V> get(K key) { return (Set<V>)getByKey(key) ; }
-    
-    @Override
-    public Set<V> values(K key) { return (Set<V>)valuesForKey(key); }
-
-    @Override
-    public Set<V> values() { return Iter.toSet(flatten()) ; }
-
-
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-base/src/main/java/org/apache/jena/atlas/lib/MultiSet.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/MultiSet.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/MultiSet.java
deleted file mode 100644
index 3701042..0000000
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/MultiSet.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.atlas.lib;
-
-import java.util.ArrayList ;
-import java.util.HashMap ;
-import java.util.Iterator ;
-import java.util.List ;
-import java.util.Map ;
-import java.util.NoSuchElementException ;
-
-/** A MultiSet - also known as a Bag
- */
-
-public class MultiSet<T> implements Iterable<T>
-{
-    private Map<T,RefLong> map   = new HashMap<>() ;
-    private int multiSetSize = 0 ;
-    
-    private RefLong _get(T obj)
-    {
-        RefLong z = map.get(obj) ;
-        if ( z == null )
-        {
-            z = new RefLong(0) ;
-            map.put(obj, z) ;
-        }
-        return z ;
-    }
- 
-    /** Does it contain any elements at all? */
-    public boolean isEmpty()        { return map.isEmpty() ; }
-
-    /** Does it contain the object? */
-    public boolean contains(T obj)  { return map.containsKey(obj) ; }
-    
-    /** Yield one object per element (i.e without counts) */
-    public Iterator<T> elements()   { return map.keySet().iterator() ; }
-
-    /** Add an object */
-    public void add(T obj)          { _get(obj).inc(); multiSetSize++ ; } 
-
-    /** Add an object, with cardinality n */
-    public void add(T obj, long n)
-    { 
-        if ( n <= 0 ) return ;
-        _get(obj).add(n) ;
-        multiSetSize += n ;
-    }
-    
-    /** Remove one occurrence of the object from the multiset */
-    public void remove(T obj)
-    {
-        RefLong x = map.get(obj) ;
-        if ( x == null ) return ;
-        x.dec() ;
-        multiSetSize-- ;
-        if ( x.value() == 0 )
-            map.remove(obj) ;
-    }
-    
-    /** Remove N occurrences of the object from the multiset */
-    public void remove(T obj, long n)
-    {
-        RefLong x = map.get(obj) ;
-        if ( x == null ) return ;
-        long z = x.value() ;
-        if ( z < n )
-            n = z ;
-        x.subtract(n) ;
-        multiSetSize -= n ;
-        if ( x.value() <= 0 )
-            map.remove(obj) ;
-    }    
-    
-
-    /** Remove all occurrences of the object in themultiset */
-    public void removeAll(T obj)
-    {
-        RefLong x = map.get(obj) ;
-        if ( x == null )
-            return ;
-        multiSetSize -= x.value() ;
-        map.remove(obj) ;
-    }
-
-    /* Remove everything */
-    public void clear() { map.clear() ; multiSetSize = 0 ; }
-    
-    
-    /** Get the count of the number of times the object appears in the multiset - i.e. it's cardinality.
-     * Returns zero when not present.
-     */
-    public long count(T obj)
-    {
-        if ( ! map.containsKey(obj) ) return 0 ;
-        return map.get(obj).value() ;
-    }
-    
-    public int size()
-    {
-//        int count = 0 ;
-//        for ( Map.Entry<T, RefLong> e : map.entrySet() )
-//            count += e.getValue().value() ;
-//        //return count ;
-//        if ( count != multiSetSize )
-//        {
-//            Log.warn(this, "Mismatch") ;
-//            return count ; 
-//        }
-
-        return multiSetSize ;
-    }
-    
-    private Iterator<T> iterator1()
-    {
-        // CRUDE
-        List<T> expanded = new ArrayList<>() ;
-        for ( Map.Entry<T, RefLong> e : map.entrySet() )
-        {
-            for ( int i = 0 ; i < e.getValue().value() ; i++ )
-                expanded.add(e.getKey()) ;
-        }
-        
-        return expanded.iterator() ;
-    }
-    
-    @Override
-    public Iterator<T> iterator()
-    {
-        return new Iterator<T>() {
-            
-            Iterator<T> keys = map.keySet().iterator() ;
-            T key = null ;
-            long keyCount = 0 ;
-            T slot = null ;
-            
-            @Override
-            public boolean hasNext()
-            {
-                if ( slot != null )
-                    return true ;
-                
-                if ( keys == null ) 
-                    return false ;
-                
-                if ( key != null )
-                {
-                    if ( keyCount < count(key) )
-                    {
-                        keyCount++ ;
-                        slot = key ;
-                        return true ;
-                    }
-                    // End of this key.
-                    key = null ;
-                }
-                    
-                if ( keys.hasNext() )
-                {
-                    key = keys.next() ;
-                    keyCount = 1 ;
-                    slot = key ;
-                    return true ;
-                }
-                keys = null ;
-                return false ;
-            }
-
-            @Override
-            public T next()
-            {
-                if ( ! hasNext() ) throw new NoSuchElementException() ;
-                T x = slot ;
-                slot = null ;
-                return x ;
-            }
-
-            @Override
-            public void remove()
-            { throw new UnsupportedOperationException() ; }
-        } ; 
-    }
-    
-    @Override 
-    public String toString()
-    {
-        StringBuilder sb = new StringBuilder() ;
-        sb.append("{") ;
-        String sep = "" ;
-        for ( Map.Entry<T, RefLong> e : map.entrySet() )
-        {
-            sb.append(sep) ;
-            sep = ", " ;
-            sb.append(e.getKey().toString()) ;
-            sb.append("=") ;
-            sb.append(Long.toString(e.getValue().value())) ;
-        }
-        sb.append("}") ;
-        return sb.toString() ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-base/src/main/java/org/apache/jena/atlas/lib/PropertyUtils.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/PropertyUtils.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/PropertyUtils.java
index d4ac5b7..f9acfc8 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/PropertyUtils.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/lib/PropertyUtils.java
@@ -92,7 +92,7 @@ public class PropertyUtils {
 
     /** Test whether a property has a value. Null tests equal to not present. */
     public boolean propertyEquals(Properties properties, String key, String value) {
-        return Lib.equal(properties.getProperty(key), value) ;
+        return Objects.equals(properties.getProperty(key), value) ;
     }
 
     /** Set property if not already set. */
@@ -130,7 +130,7 @@ public class PropertyUtils {
     public void checkMetadata(Properties properties, String key, String expected) {
         String value = properties.getProperty(key) ;
 
-        if ( !Lib.equal(value, value) )
+        if ( !Objects.equals(value, value) )
             inconsistent(properties, key, value, expected) ;
     }
 

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-base/src/main/java/org/apache/jena/atlas/lib/StrUtils.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/StrUtils.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/StrUtils.java
index 9a9be76..a61af11 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/StrUtils.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/lib/StrUtils.java
@@ -18,10 +18,15 @@
 
 package org.apache.jena.atlas.lib;
 
+import static java.util.Arrays.stream;
+import static java.util.stream.Collectors.joining;
+import static java.util.stream.Collectors.toList;
+
 import java.io.UnsupportedEncodingException ;
 import java.util.ArrayList ;
 import java.util.List ;
 import java.util.Map ;
+import java.util.stream.Collectors;
 
 
 public class StrUtils //extends StringUtils
@@ -54,27 +59,12 @@ public class StrUtils //extends StringUtils
     
     private static String join(String sep, List<String> a)
     {
-        return join(sep, a.toArray(new String[0])) ;
+        return a.stream().collect(joining(sep));
     }
     
     private static String join(String sep, String...a)
-    {
-        if ( a.length == 0 )
-            return "" ;
-
-        if ( a.length == 1)
-            return a[0] ;
-
-        StringBuilder sbuff = new StringBuilder() ;
-        sbuff.append(a[0]) ;
-
-        for ( int i = 1 ; i < a.length ; i++ )
-        {
-            if ( sep != null )
-                sbuff.append(sep) ;
-            sbuff.append(a[i]) ;
-        }
-        return sbuff.toString() ;
+    {	
+    		return stream(a).collect(joining(sep));
     }
     
     public static final int CMP_GREATER  = +1 ;
@@ -127,12 +117,7 @@ public class StrUtils //extends StringUtils
     /** Split but also trim whiespace. */
     public static String[] split(String s, String splitStr)
     {
-        String[] x = s.split(splitStr) ;
-        for ( int i = 0 ; i < x.length ; i++ )
-        {
-            x[i] = x[i].trim() ;
-        }
-        return x ;
+        return stream(s.split(splitStr)).map(String::trim).toArray(String[]::new);
     }
     
     /** Does one string contain another string?
@@ -152,7 +137,7 @@ public class StrUtils //extends StringUtils
     
     public static String substitute(String str, Map<String, String>subs)
     {
-        for ( Map.Entry<String, String> e : subs.entrySet() )
+    		for ( Map.Entry<String, String> e : subs.entrySet() )
         {
             String param = e.getKey() ;
             if ( str.contains(param) ) 
@@ -182,10 +167,8 @@ public class StrUtils //extends StringUtils
     
     public static List<Character> toCharList(String str)
     {
-        List<Character> characters = new ArrayList<>(str.length()) ;
-        for ( Character ch : str.toCharArray() )
-            characters.add(ch) ;
-        return characters ;
+		return str.codePoints().mapToObj(i -> (char) i).map(Character::new)
+				.collect(toList());
     }
     
     // ==== Encoding and decoding strings based on a marker character (e.g. %)

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-base/src/main/java/org/apache/jena/atlas/lib/Tuple.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/Tuple.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/Tuple.java
index 35a97a5..f991d65 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/Tuple.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/lib/Tuple.java
@@ -21,6 +21,7 @@ package org.apache.jena.atlas.lib ;
 import java.util.Arrays ;
 import java.util.Iterator ;
 import java.util.List ;
+import java.util.Objects;
 import java.util.function.Function;
 
 import org.apache.jena.atlas.iterator.Iter ;
@@ -37,9 +38,6 @@ public class Tuple<T> implements Iterable<T> {
     /**
      * Create a tuple from an array of elements. The array is not copied and
      * should not be modified after this call.
-     * <p>
-     * There is also a {@link TupleBuilder} which does create an idendent
-     * copy, in case that style is preferrable for creating tuples.
      */
     public static <X> Tuple<X> create(X[] elements) {
         return new Tuple<>(elements) ;
@@ -90,7 +88,7 @@ public class Tuple<T> implements Iterable<T> {
 
     @Override
     public Iterator<T> iterator() {
-        return Arrays.stream(tuple).iterator() ;
+        return Arrays.asList(tuple).iterator() ;
     }
 
     /** Return a tuple with the column mapping applied */
@@ -130,7 +128,7 @@ public class Tuple<T> implements Iterable<T> {
         for ( int i = 0 ; i < tuple.length ; i++ ) {
             Object obj1 = tuple[i] ;
             Object obj2 = x.tuple[i] ;
-            if ( !Lib.equal(obj1, obj2) )
+            if ( !Objects.equals(obj1, obj2) )
                 return false ;
         }
         return true ;

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-base/src/main/java/org/apache/jena/atlas/lib/TupleBuilder.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/TupleBuilder.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/TupleBuilder.java
deleted file mode 100644
index 278334d..0000000
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/TupleBuilder.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.atlas.lib;
-
-
-import java.util.ArrayList ;
-import java.util.List ;
-
-/** Tuple builder class - tuples are immutable, this is how to create them in the builder style */
-public class TupleBuilder<T> 
-{
-    private List<T> x = new ArrayList<>() ;
-    
-    public TupleBuilder() { } 
-    
-    public TupleBuilder<T> add(T element) {
-        x.add(element) ;
-        return this ;
-    }
-    
-    public TupleBuilder<T> reset() {
-        x.clear() ;
-        return this ;
-    }
-    
-    public Tuple<T> build() { 
-        @SuppressWarnings("unchecked")
-        T[] elts = (T[])new Object[x.size()] ; 
-        // Copy contents, should not create a new array because elts
-        // is created with the right size so elts == elts2 
-        T[] elts2 = x.toArray(elts) ;
-        return new Tuple<>(elts2) ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-base/src/main/java/org/apache/jena/atlas/lib/cache/Getter.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/cache/Getter.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/cache/Getter.java
deleted file mode 100644
index c9f879c..0000000
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/cache/Getter.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.atlas.lib.cache;
-
-/** A get interface */
-public interface Getter<K, V>
-{
-    public V get(K key) ; 
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-base/src/test/java/org/apache/jena/atlas/lib/TS_Lib.java
----------------------------------------------------------------------
diff --git a/jena-base/src/test/java/org/apache/jena/atlas/lib/TS_Lib.java b/jena-base/src/test/java/org/apache/jena/atlas/lib/TS_Lib.java
index b91d4ad..ac543c0 100644
--- a/jena-base/src/test/java/org/apache/jena/atlas/lib/TS_Lib.java
+++ b/jena-base/src/test/java/org/apache/jena/atlas/lib/TS_Lib.java
@@ -46,7 +46,6 @@ import org.junit.runners.Suite ;
     , TestReverseComparator.class
     , TestTrie.class
     , TestFilenameProcessing.class
-    , TestMultiSet.class
     , TestNumberUtils.class
     , TestDateTimeUtils.class
 } )

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-base/src/test/java/org/apache/jena/atlas/lib/TestMultiSet.java
----------------------------------------------------------------------
diff --git a/jena-base/src/test/java/org/apache/jena/atlas/lib/TestMultiSet.java b/jena-base/src/test/java/org/apache/jena/atlas/lib/TestMultiSet.java
deleted file mode 100644
index 477386b..0000000
--- a/jena-base/src/test/java/org/apache/jena/atlas/lib/TestMultiSet.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.atlas.lib;
-
-import java.util.Arrays ;
-import java.util.Collections ;
-import java.util.List ;
-
-import org.apache.jena.atlas.iterator.Iter ;
-import org.apache.jena.atlas.junit.BaseTest ;
-import org.apache.jena.atlas.lib.MultiSet ;
-import org.junit.Test ;
-
-
-public class TestMultiSet extends BaseTest
-{
-    @Test public void multiSet_01()
-    {
-        MultiSet<String> x = new MultiSet<>() ;
-        assertTrue(x.isEmpty()) ;
-        assertEquals(0, x.count("A")) ;
-    }
-
-    @Test public void multiSet_02()
-    {
-        MultiSet<String> x = new MultiSet<>() ;
-        x.add("A") ;
-        assertFalse(x.isEmpty()) ;
-        assertEquals(1, x.count("A") ) ;
-        x.add("A") ;
-        assertEquals(2, x.count("A") ) ;
-    }
-
-    @Test public void multiSet_03()
-    {
-        MultiSet<String> x = new MultiSet<>() ;
-        x.add("A") ;
-        x.add("A") ;
-        x.remove("A") ;
-        assertEquals(1, x.count("A") ) ;
-        assertTrue(x.contains("A")) ;
-        x.remove("A") ;
-        assertEquals(0, x.count("A") ) ;
-        assertFalse(x.contains("A")) ;
-    }
-
-    @Test public void multiSet_04()
-    {
-        String[] data = { } ;
-        iterTest(data) ;
-    }
-
-
-    @Test public void multiSet_05()
-    {
-        String[] data = { "A" } ;
-        iterTest(data) ;
-    }
-
-    @Test public void multiSet_06()
-    {
-        String[] data = { "A", "B", "C" } ;
-        iterTest(data) ;
-    }
-
-
-    @Test public void multiSet_07()
-    {
-        String[] data = { "A", "B", "C", "A" } ;
-        iterTest(data) ;
-    }
-
-    @Test public void multiSet_08()
-    {
-        String[] data = {  } ;
-        MultiSet<String> x = add(data) ;
-        assertEquals(0, x.size()) ;
-    }
-    
-    @Test public void multiSet_09()
-    {
-        String[] data = { "A", "A" } ;
-        MultiSet<String> x = add(data) ;
-        assertEquals(2, x.size()) ;
-    }
-
-    @Test public void multiSet_10()
-    {
-        String[] data = { "A", "A" } ;
-        MultiSet<String> x = add(data) ;
-        x.remove("A") ;
-        assertEquals(1, x.size()) ;
-        x.remove("A") ;
-        assertEquals(0, x.size()) ;
-        x.remove("A") ;
-        assertEquals(0, x.size()) ;
-    }
-    
-    @Test public void multiSet_11()
-    {
-        String[] data = { "A", "A" } ;
-        MultiSet<String> x = add(data) ;
-        long c = Iter.count(x.elements()) ;
-        assertEquals(1, c) ;
-    }
-    
-    private static MultiSet<String> add(String[] data)
-    {
-        MultiSet<String> x = new MultiSet<>() ;
-        for ( String str : data )
-            x.add(str) ;
-        return x ;
-    }
-    
-    private static void iterTest(String[] data)
-    {
-        List<String> expected = Arrays.asList(data) ;
-        MultiSet<String> x = new MultiSet<>() ;
-        for ( String str : data )
-            x.add(str) ;
-        List<String> actual = Iter.toList(x.iterator()) ;
-        Collections.sort(expected) ;
-        Collections.sort(actual) ;
-        assertEquals(expected, actual) ;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableHashMapImpl.java
----------------------------------------------------------------------
diff --git a/jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableHashMapImpl.java b/jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableHashMapImpl.java
index cee257f..622b3f1 100644
--- a/jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableHashMapImpl.java
+++ b/jena-csv/src/main/java/org/apache/jena/propertytable/impl/PropertyTableHashMapImpl.java
@@ -19,11 +19,12 @@
 package org.apache.jena.propertytable.impl;
 
 import java.util.* ;
-import java.util.Map.Entry ;
+import java.util.Map.Entry;
 
 import org.apache.jena.atlas.iterator.Iter;
 import org.apache.jena.atlas.iterator.IteratorConcat;
-import org.apache.jena.atlas.lib.MultiMapToSet ;
+import org.apache.jena.ext.com.google.common.collect.HashMultimap;
+import org.apache.jena.ext.com.google.common.collect.SetMultimap ;
 import org.apache.jena.graph.Node ;
 import org.apache.jena.graph.Triple ;
 import org.apache.jena.propertytable.Column;
@@ -50,7 +51,7 @@ public class PropertyTableHashMapImpl implements PropertyTable {
 	private Map<Node, Map<Node, Node>> valueIndex; 
 	// POS index
 	// Maps column Node to (value, subject Node) pairs
-	private Map<Node, MultiMapToSet<Node, Node>> valueReverseIndex; 
+	private Map<Node, SetMultimap<Node, Node>> valueReverseIndex; 
 
 	PropertyTableHashMapImpl() {
 		columnIndex = new HashMap<Node, Column>();
@@ -58,7 +59,7 @@ public class PropertyTableHashMapImpl implements PropertyTable {
 		rowIndex = new HashMap<Node, Row>();
 		rowList = new ArrayList<Row>();
 		valueIndex = new HashMap<Node, Map<Node, Node>>();
-		valueReverseIndex = new HashMap<Node, MultiMapToSet<Node, Node>>();
+		valueReverseIndex = new HashMap<Node, SetMultimap<Node, Node>>();
 	}
 
 	@Override
@@ -120,7 +121,7 @@ public class PropertyTableHashMapImpl implements PropertyTable {
 		
 		
 		Node p = column.getColumnKey();
-		final MultiMapToSet<Node, Node> valueToSubjectMap = valueReverseIndex.get(p);
+		final SetMultimap<Node, Node> valueToSubjectMap = valueReverseIndex.get(p);
 		if ( valueToSubjectMap == null ) 
 		    return NullIterator.instance() ;
 		final Set<Node> subjects = valueToSubjectMap.get(value);
@@ -171,7 +172,7 @@ public class PropertyTableHashMapImpl implements PropertyTable {
 		columnIndex.put(p, new ColumnImpl(this, p));
 		columnList.add(columnIndex.get(p));
 		valueIndex.put(p, new HashMap<Node, Node>());
-		valueReverseIndex.put(p, MultiMapToSet.<Node, Node> create());
+		valueReverseIndex.put(p, HashMultimap.create());
 		return getColumn(p);
 	}
 
@@ -226,7 +227,7 @@ public class PropertyTableHashMapImpl implements PropertyTable {
 		
 		
 		Node p = column.getColumnKey();
-		final MultiMapToSet<Node, Node> valueToSubjectMap = valueReverseIndex.get(p);
+		final SetMultimap<Node, Node> valueToSubjectMap = valueReverseIndex.get(p);
 		if ( valueToSubjectMap == null )
 		    return Collections.emptyList() ;
 		final Set<Node> subjects = valueToSubjectMap.get(value);
@@ -257,7 +258,7 @@ public class PropertyTableHashMapImpl implements PropertyTable {
 
 	private void addToReverseMap(final Node p, final Node s, final Node oldValue, final Node value) {
 
-		final MultiMapToSet<Node, Node> valueToSubjectMap = valueReverseIndex.get(p);
+		final SetMultimap<Node, Node> valueToSubjectMap = valueReverseIndex.get(p);
 		if ( valueToSubjectMap == null )
             return ; 
 		valueToSubjectMap.remove(oldValue, s);
@@ -281,7 +282,7 @@ public class PropertyTableHashMapImpl implements PropertyTable {
 
 	private void removeFromReverseMap(final Node p, final Node s,
 			final Node value) {
-		final MultiMapToSet<Node, Node> valueTokeysMap = valueReverseIndex.get(p);
+		final SetMultimap<Node, Node> valueTokeysMap = valueReverseIndex.get(p);
 		if ( valueTokeysMap == null )
 		    return ;
 		valueTokeysMap.remove(s, value);

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiLib.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiLib.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiLib.java
index ca216f3..e06d692 100644
--- a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiLib.java
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/FusekiLib.java
@@ -23,9 +23,9 @@ import java.util.Iterator ;
 import javax.servlet.http.HttpServletRequest ;
 
 import org.apache.commons.lang.StringUtils ;
-import org.apache.jena.atlas.lib.MultiMap ;
-import org.apache.jena.atlas.lib.MultiMapToList ;
 import org.apache.jena.atlas.web.ContentType ;
+import org.apache.jena.ext.com.google.common.collect.ArrayListMultimap;
+import org.apache.jena.ext.com.google.common.collect.Multimap;
 import org.apache.jena.fuseki.servlets.HttpAction ;
 import org.apache.jena.graph.Graph ;
 import org.apache.jena.graph.Node ;
@@ -87,8 +87,8 @@ public class FusekiLib {
     }
 
     /** Parse the query string - do not process the body even for a form */
-    public static MultiMap<String, String> parseQueryString(HttpServletRequest req) {
-        MultiMap<String, String> map = MultiMapToList.create() ;
+    public static Multimap<String, String> parseQueryString(HttpServletRequest req) {
+        Multimap<String, String> map = ArrayListMultimap.create() ;
 
         // Don't use ServletRequest.getParameter or getParamterNames
         // as that reads form data. This code parses just the query string.

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Protocol.java
----------------------------------------------------------------------
diff --git a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Protocol.java b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Protocol.java
index 84bb858..ed106d8 100644
--- a/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Protocol.java
+++ b/jena-fuseki1/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Protocol.java
@@ -24,6 +24,8 @@ import static org.apache.jena.fuseki.HttpNames.paramNamedGraphURI ;
 import java.util.Arrays ;
 import java.util.Collections ;
 import java.util.List ;
+import java.util.Objects;
+
 import javax.servlet.http.HttpServletRequest ;
 
 import org.apache.jena.atlas.iterator.Iter ;
@@ -74,7 +76,7 @@ public  abstract class SPARQL_Protocol extends SPARQL_ServletBase
 
     private static List<String> removeEmptyValues(List<String> list)
     {
-        return Iter.iter(list).filter(item -> item != null && item.length() != 0).toList() ;
+        return Iter.iter(list).filter(Objects::nonNull).filter(item -> !item.isEmpty()).toList() ;
     }
     
     protected static int countParamOccurences(HttpServletRequest request, String param)

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiLib.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiLib.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiLib.java
index 3a2a409..1138260 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiLib.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/FusekiLib.java
@@ -22,9 +22,9 @@ import java.util.Iterator ;
 
 import javax.servlet.http.HttpServletRequest ;
 
-import org.apache.jena.atlas.lib.MultiMap ;
-import org.apache.jena.atlas.lib.MultiMapToList ;
 import org.apache.jena.atlas.web.ContentType ;
+import org.apache.jena.ext.com.google.common.collect.ArrayListMultimap;
+import org.apache.jena.ext.com.google.common.collect.Multimap;
 import org.apache.jena.fuseki.server.SystemState ;
 import org.apache.jena.fuseki.servlets.HttpAction ;
 import org.apache.jena.graph.Graph ;
@@ -95,8 +95,8 @@ public class FusekiLib {
     }
 
     /** Parse the query string - do not process the body even for a form */
-    public static MultiMap<String, String> parseQueryString(HttpServletRequest req) {
-        MultiMap<String, String> map = MultiMapToList.create() ;
+    public static Multimap<String, String> parseQueryString(HttpServletRequest req) {
+        Multimap<String, String> map = ArrayListMultimap.create() ;
 
         // Don't use ServletRequest.getParameter or getParamterNames
         // as that reads form data. This code parses just the query string.

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/DataService.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/DataService.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/DataService.java
index 1037390..e4b8793 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/DataService.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/DataService.java
@@ -25,8 +25,8 @@ import java.util.* ;
 import java.util.concurrent.atomic.AtomicBoolean ;
 import java.util.concurrent.atomic.AtomicLong ;
 
-import org.apache.jena.atlas.lib.MultiMap ;
-import org.apache.jena.atlas.lib.MultiMapToList ;
+import org.apache.jena.ext.com.google.common.collect.ArrayListMultimap;
+import org.apache.jena.ext.com.google.common.collect.ListMultimap;
 import org.apache.jena.fuseki.DEF ;
 import org.apache.jena.fuseki.Fuseki ;
 import org.apache.jena.fuseki.build.DataServiceDesc ;
@@ -54,7 +54,7 @@ public class DataService { //implements DatasetMXBean {
     private final DataServiceDesc svcDesc ;
     private DatasetGraph dataset = null ;              // Only valid if active.
 
-    private MultiMapToList<OperationName, Endpoint> operations     = MultiMap.createMapList() ;
+    private ListMultimap<OperationName, Endpoint> operations     = ArrayListMultimap.create() ;
     private Map<String, Endpoint> endpoints                        = new HashMap<>() ;
     
     private volatile DatasetStatus state = UNINITIALIZED ;

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Protocol.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Protocol.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Protocol.java
index 2a19d03..0be8b6c 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Protocol.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Protocol.java
@@ -79,7 +79,7 @@ public  abstract class SPARQL_Protocol extends ActionSPARQL
         return Iter.iter(list).filter(acceptNonEmpty).toList() ;
     }
     
-    private static Predicate<String> acceptNonEmpty = item -> item != null && item.length() != 0;
+    private static Predicate<String> acceptNonEmpty = item -> item != null && !item.isEmpty();
     
     protected static int countParamOccurences(HttpServletRequest request, String param)
     {

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-tdb/src/main/java/org/apache/jena/tdb/base/block/BlockMgrTracker.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/base/block/BlockMgrTracker.java b/jena-tdb/src/main/java/org/apache/jena/tdb/base/block/BlockMgrTracker.java
index 0173261..9d2f9ee 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/base/block/BlockMgrTracker.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/base/block/BlockMgrTracker.java
@@ -24,7 +24,8 @@ import java.util.ArrayList ;
 import java.util.Iterator ;
 import java.util.List ;
 
-import org.apache.jena.atlas.lib.MultiSet ;
+import org.apache.jena.ext.com.google.common.collect.HashMultiset;
+import org.apache.jena.ext.com.google.common.collect.Multiset;
 import org.apache.jena.atlas.lib.Pair ;
 import org.apache.jena.tdb.TDBException ;
 import org.slf4j.Logger ;
@@ -42,9 +43,9 @@ public class BlockMgrTracker /*extends BlockMgrWrapper*/ implements BlockMgr
     // ---- State for tracking
     // Track and count block references and releases
     //   No - the page is dirty.
-    protected final MultiSet<Long> activeReadBlocks   = new MultiSet<>() ;
-    protected final MultiSet<Long> activeWriteBlocks  = new MultiSet<>() ;
-    protected final MultiSet<Long> activeIterBlocks   = new MultiSet<>() ;
+    protected final Multiset<Long> activeReadBlocks   = HashMultiset.create() ;
+    protected final Multiset<Long> activeWriteBlocks  = HashMultiset.create() ;
+    protected final Multiset<Long> activeIterBlocks   = HashMultiset.create() ;
     // Track the operations 
     protected final List<Pair<Action, Long>> actions = new ArrayList<>() ;
     protected final List<Iterator<?>> activeIterators = new ArrayList<>() ;
@@ -59,13 +60,6 @@ public class BlockMgrTracker /*extends BlockMgrWrapper*/ implements BlockMgr
         actions.clear() ;
     }
     
-    private void clearInternalIter()
-    {
-        clearInternalRW() ;
-        activeIterators.clear() ;
-        activeIterBlocks.clear() ;
-    }
-
     private int inRead = 0 ;
     private int inIterator = 0 ;
     private boolean inUpdate = false ;
@@ -79,11 +73,6 @@ public class BlockMgrTracker /*extends BlockMgrWrapper*/ implements BlockMgr
         return new BlockMgrTracker(label, blkMgr) ;
     }
 
-    private BlockMgrTracker(BlockMgr blockMgr)
-    {
-        this(LoggerFactory.getLogger(BlockMgrTracker.class), blockMgr.getLabel(), blockMgr) ;
-    }
-    
     private BlockMgrTracker(String label, BlockMgr blockMgr)
     {
         this(loggerDefault, label, blockMgr) ;
@@ -411,7 +400,7 @@ public class BlockMgrTracker /*extends BlockMgrWrapper*/ implements BlockMgr
     }
 
 
-    private void checkEmpty(String string, MultiSet<Long> blocks)
+    private void checkEmpty(String string, Multiset<Long> blocks)
     {
         if ( ! blocks.isEmpty() )
         {
@@ -440,11 +429,6 @@ public class BlockMgrTracker /*extends BlockMgrWrapper*/ implements BlockMgr
         log.warn(msg(string)) ;
     }
 
-    private void warn(Action action, String string)
-    {
-        warn(action + ": " + string) ;
-    }
-   
     private void error(String string)
     {
         log.error(msg(string)) ;
@@ -461,9 +445,6 @@ public class BlockMgrTracker /*extends BlockMgrWrapper*/ implements BlockMgr
         //debugPoint() ;
     }
 
-    // Do nothing - but use a a breakpoint point.
-    private void debugPoint() {}
-
     private void history()
     {
         info("History") ;

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-text/src/main/java/org/apache/jena/query/text/EntityDefinition.java
----------------------------------------------------------------------
diff --git a/jena-text/src/main/java/org/apache/jena/query/text/EntityDefinition.java b/jena-text/src/main/java/org/apache/jena/query/text/EntityDefinition.java
index 1eb97b9..2f15ffb 100644
--- a/jena-text/src/main/java/org/apache/jena/query/text/EntityDefinition.java
+++ b/jena-text/src/main/java/org/apache/jena/query/text/EntityDefinition.java
@@ -23,7 +23,8 @@ import java.util.Collections ;
 import java.util.HashMap ;
 import java.util.Map ;
 
-import org.apache.jena.atlas.lib.MultiMap ;
+import org.apache.jena.ext.com.google.common.collect.ArrayListMultimap;
+import org.apache.jena.ext.com.google.common.collect.ListMultimap;
 import org.apache.jena.graph.Node ;
 import org.apache.jena.rdf.model.Resource ;
 import org.apache.lucene.analysis.Analyzer ;
@@ -34,7 +35,7 @@ import org.apache.lucene.analysis.Analyzer ;
 public class EntityDefinition {
     private final Map<Node, String>      predicateToField = new HashMap<>() ;
     private final Map<String, Analyzer>    fieldToAnalyzer  = new HashMap<>();
-    private final MultiMap<String, Node> fieldToPredicate = MultiMap.createMapList() ;
+    private final ListMultimap<String, Node> fieldToPredicate = ArrayListMultimap.create() ;
     private final Collection<String>     fields           = Collections.unmodifiableCollection(fieldToPredicate.keys()) ;
     // private final Collection<String> fields =
     // Collections.unmodifiableCollection(fieldToPredicate.keySet()) ;

http://git-wip-us.apache.org/repos/asf/jena/blob/a664cb6c/jena-text/src/main/java/org/apache/jena/query/text/assembler/EntityDefinitionAssembler.java
----------------------------------------------------------------------
diff --git a/jena-text/src/main/java/org/apache/jena/query/text/assembler/EntityDefinitionAssembler.java b/jena-text/src/main/java/org/apache/jena/query/text/assembler/EntityDefinitionAssembler.java
index f677778..a54fc92 100644
--- a/jena-text/src/main/java/org/apache/jena/query/text/assembler/EntityDefinitionAssembler.java
+++ b/jena-text/src/main/java/org/apache/jena/query/text/assembler/EntityDefinitionAssembler.java
@@ -28,9 +28,11 @@ import java.util.Map;
 import org.apache.jena.assembler.Assembler ;
 import org.apache.jena.assembler.Mode ;
 import org.apache.jena.assembler.assemblers.AssemblerBase ;
-import org.apache.jena.atlas.lib.MultiMap ;
 import org.apache.jena.atlas.lib.StrUtils ;
 import org.apache.jena.atlas.logging.Log ;
+import org.apache.jena.ext.com.google.common.collect.HashMultimap;
+import org.apache.jena.ext.com.google.common.collect.Multimap;
+import org.apache.jena.ext.com.google.common.collect.Multimaps;
 import org.apache.jena.graph.Node ;
 import org.apache.jena.query.* ;
 import org.apache.jena.query.text.EntityDefinition ;
@@ -88,7 +90,7 @@ public class EntityDefinitionAssembler extends AssemblerBase implements Assemble
         String graphField = qsol1.contains("graphField") ? qsol1.getLiteral("graphField").getLexicalForm() : null;
         String defaultField = qsol1.contains("dftField") ? qsol1.getLiteral("dftField").getLexicalForm() : null ;
 
-        MultiMap<String, Node> mapDefs = MultiMap.createMapList() ; 
+        Multimap<String, Node> mapDefs = HashMultimap.create() ; 
         Map<String, Analyzer> analyzerDefs = new HashMap<>();
 
         Statement listStmt = root.getProperty(TextVocab.pMap);
@@ -97,7 +99,7 @@ public class EntityDefinitionAssembler extends AssemblerBase implements Assemble
             if (! n.isResource()) {
                 throw new TextIndexException("Text list node is not a resource : " + n);
             }
-            Resource listResource = (Resource) n;
+            Resource listResource = n.asResource();
             if (listResource.equals(RDF.nil)) {
                 break;  // end of the list
             }
@@ -110,7 +112,7 @@ public class EntityDefinitionAssembler extends AssemblerBase implements Assemble
             if (! n.isResource()) {
                 throw new TextIndexException("Text map list entry is not a resource : " + n);
             }
-            Resource listEntry = (Resource) n;
+            Resource listEntry = n.asResource();
 
             Statement fieldStatement = listEntry.getProperty(TextVocab.pField);
             if (fieldStatement == null) {
@@ -120,7 +122,7 @@ public class EntityDefinitionAssembler extends AssemblerBase implements Assemble
             if (! n.isLiteral()) {
                 throw new TextIndexException("Text map entry field property has no literal value : " + n);
             }
-            String field = ((Literal)n).getLexicalForm();
+            String field = n.asLiteral().getLexicalForm();
 
             Statement predicateStatement = listEntry.getProperty(TextVocab.pPredicate);
             if (predicateStatement == null) {
@@ -130,8 +132,7 @@ public class EntityDefinitionAssembler extends AssemblerBase implements Assemble
             if (! n.isURIResource()) {
                 throw new TextIndexException("Text map entry predicate property has non resource value : " + n);
             }
-            Resource predicate = (Resource) n;
-            mapDefs.put(field, predicate.asNode()) ;
+            mapDefs.put(field, n.asNode()) ;
 
             Statement analyzerStatement = listEntry.getProperty(TextVocab.pAnalyzer);
             if (analyzerStatement != null) {
@@ -139,7 +140,7 @@ public class EntityDefinitionAssembler extends AssemblerBase implements Assemble
                 if (! n.isResource()) {
                     throw new TextIndexException("Text map entry analyzer property is not a resource : " + n);
                 }
-                Resource analyzerResource = (Resource) n;
+                Resource analyzerResource = n.asResource();
                 Analyzer analyzer = (Analyzer) a.open(analyzerResource);
                 analyzerDefs.put(field, analyzer);
             }
@@ -151,7 +152,7 @@ public class EntityDefinitionAssembler extends AssemblerBase implements Assemble
         // Primary field/predicate
         if ( defaultField != null ) {
             Collection<Node> c = mapDefs.get(defaultField) ;
-            if ( c == null )
+            if ( c.isEmpty() )
                 throw new TextIndexException("No definition of primary field '"+defaultField+"'") ;
         }
 


Mime
View raw message