diff --git a/CHANGELOG.md b/CHANGELOG.md
index b66fb1e..a224247 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
# toml4j Changelog
+## 0.5.1 / 2016-01-24
+
+### Fixed
+
+* [Handling of tables with same name in different table array items](https://github.com/mwanji/toml4j/issues/26) (thanks to __[stanofujdiar](https://github.com/stanofujdiar)__)
+
## 0.5.0 / 2015-12-10
### Changed
diff --git a/README.md b/README.md
index 9473846..f9c085a 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ Add the following dependency to your POM (or equivalent for other dependency man
com.moandjiezana.toml
toml4j
- 0.4.0
+ 0.5.1
```
@@ -23,7 +23,7 @@ Requires Java 1.6.
## Quick start
```java
-Toml toml = new Toml().parse(getTomlFile());
+Toml toml = new Toml().read(getTomlFile());
String someValue = toml.getString("someKey");
Date someDate = toml.getDate("someTable.someDate");
MyClass myClass = toml.to(MyClass.class);
@@ -31,10 +31,10 @@ MyClass myClass = toml.to(MyClass.class);
## Usage
-A `com.moandjiezana.toml.Toml` instance is populated by calling one of `parse(File)`, `parse(InputStream)`, `parse(Reader)` or `parse(String)`.
+A `com.moandjiezana.toml.Toml` instance is populated by calling one of `read(File)`, `read(InputStream)`, `read(Reader)` or `read(String)`.
```java
-Toml toml = new Toml().parse("a=1");
+Toml toml = new Toml().read("a=1");
```
An exception is thrown if the source is not valid TOML.
@@ -70,7 +70,7 @@ class User {
```
```java
-User user = new Toml().parse(tomlFile).to(User.class);
+User user = new Toml().read(tomlFile).to(User.class);
assert user.name.equals("Mwanji Ezana");
assert user.address.street.equals("123 A Street");
@@ -146,7 +146,7 @@ title = "TOML Example"
```
```java
-Toml toml = new Toml().parse(getTomlFile());
+Toml toml = new Toml().read(getTomlFile());
String title = toml.getString("title");
String subTitle = toml.getString("\"sub title\"");
@@ -191,8 +191,8 @@ a = 1
```
```java
-Toml defaults = new Toml().parse(getDefaultsFile());
-Toml toml = new Toml(defaults).parse(getTomlFile());
+Toml defaults = new Toml().read(getDefaultsFile());
+Toml toml = new Toml(defaults).read(getTomlFile());
Long a = toml.getLong("a"); // returns 1, not 2
Long b = toml.getLong("b"); // returns 3, taken from defaults provided to constructor
@@ -217,7 +217,7 @@ for (Map.Entry entry : myToml.entrySet()) {
You can also convert a Toml instance to a `Map`:
```java
-Toml toml = new Toml().parse("a = 1");
+Toml toml = new Toml().read("a = 1");
Map map = toml.to(Map.class);
```
@@ -225,7 +225,7 @@ Map map = toml.to(Map.class);
```java
-Toml toml = new Toml().parse("a = 1");
+Toml toml = new Toml().read("a = 1");
toml.contains("a"); // true
toml.conatinsKey("a"); // true
diff --git a/src/main/java/com/moandjiezana/toml/Container.java b/src/main/java/com/moandjiezana/toml/Container.java
index 0b1a24f..56cce75 100644
--- a/src/main/java/com/moandjiezana/toml/Container.java
+++ b/src/main/java/com/moandjiezana/toml/Container.java
@@ -10,17 +10,24 @@ abstract class Container {
abstract boolean accepts(String key);
abstract void put(String key, Object value);
abstract Object get(String key);
+ abstract boolean isImplicit();
static class Table extends Container {
private final Map values = new HashMap();
final String name;
+ final boolean implicit;
Table() {
- this.name = null;
+ this(null, false);
}
public Table(String name) {
- this.name = name;
+ this(name, false);
+ }
+
+ public Table(String tableName, boolean implicit) {
+ this.name = tableName;
+ this.implicit = implicit;
}
@Override
@@ -37,6 +44,10 @@ abstract class Container {
Object get(String key) {
return values.get(key);
}
+
+ boolean isImplicit() {
+ return implicit;
+ }
/**
* This modifies the Table's internal data structure, such that it is no longer usable.
@@ -84,6 +95,10 @@ abstract class Container {
Object get(String key) {
throw new UnsupportedOperationException();
}
+
+ boolean isImplicit() {
+ return false;
+ }
List