Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding toString to NaiveTxnHashSet

  • Loading branch information...
commit 4df3ce6e3f7b1802addab7c48e983d9cdc0b4062 1 parent fc0bb70
@sai-venkat sai-venkat authored
View
5 .gitignore
@@ -11,3 +11,8 @@ multiverse-site/target/
gradle.properties
release.properties
target/
+*.ipr
+*.iws
+*.classpath
+*.project
+*.settings
View
17 multiverse-core/src/main/java/org/multiverse/collections/NaiveTxnHashSet.java
@@ -4,7 +4,6 @@
import org.multiverse.api.Txn;
import org.multiverse.api.collections.TxnIterator;
import org.multiverse.api.collections.TxnSet;
-import org.multiverse.api.exceptions.TodoException;
import java.util.Map;
@@ -87,6 +86,20 @@ public void remove(Txn tx) {
@Override
public String toString(Txn tx) {
- throw new TodoException();
+ TxnIterator<E> it = iterator(tx);
+ if(! it.hasNext(tx)) {
+ return "[]";
+ }
+ StringBuilder result = new StringBuilder();
+ result.append('[');
+ while(it.hasNext(tx)) {
+ E item = it.next(tx);
+ result.append(item);
+ if(it.hasNext(tx)) {
+ result.append(",");
+ }
+ }
+ result.append(']');
+ return result.toString();
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.