gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lewi...@apache.org
Subject [1/3] gora git commit: Java 7 changes and improvements including diamond operators, automatic resource handling, unnecessary boxing, collapsing exceptions, and iterations.
Date Sat, 05 Sep 2015 16:05:49 GMT
Repository: gora
Updated Branches:
  refs/heads/master 550c89589 -> e201926a3


http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-core/src/test/java/org/apache/gora/mapreduce/MapReduceTestUtils.java
----------------------------------------------------------------------
diff --git a/gora-core/src/test/java/org/apache/gora/mapreduce/MapReduceTestUtils.java b/gora-core/src/test/java/org/apache/gora/mapreduce/MapReduceTestUtils.java
index c04f615..f75fa9e 100644
--- a/gora-core/src/test/java/org/apache/gora/mapreduce/MapReduceTestUtils.java
+++ b/gora-core/src/test/java/org/apache/gora/mapreduce/MapReduceTestUtils.java
@@ -55,7 +55,7 @@ public class MapReduceTestUtils {
     //create input
     WebPageDataCreator.createWebPageData(dataStore);
 
-    QueryCounter<String,WebPage> counter = new QueryCounter<String,WebPage>(conf);
+    QueryCounter<String,WebPage> counter = new QueryCounter<>(conf);
     Query<String,WebPage> query = dataStore.newQuery();
     List<Field> fields = WebPage.SCHEMA$.getFields();
     String[] fieldNames = new String[fields.size() - 1];
@@ -89,7 +89,7 @@ public class MapReduceTestUtils {
     wordCount.wordCount(inStore, outStore);
     
     //assert results
-    HashMap<String, Integer> actualCounts = new HashMap<String, Integer>();
+    HashMap<String, Integer> actualCounts = new HashMap<>();
     for(String content : WebPageDataCreator.CONTENTS) {
       if (content != null) {
         for(String token:content.split(" ")) {
@@ -119,7 +119,7 @@ public class MapReduceTestUtils {
     wordCount.wordCount(inStore, outStore);
 
     //assert results
-    HashMap<String, Integer> actualCounts = new HashMap<String, Integer>();
+    HashMap<String, Integer> actualCounts = new HashMap<>();
     for(String content : WebPageDataCreator.CONTENTS) {
       if (content != null) {
         for(String token:content.split(" ")) {

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-core/src/test/java/org/apache/gora/mapreduce/TestGoraInputFormat.java
----------------------------------------------------------------------
diff --git a/gora-core/src/test/java/org/apache/gora/mapreduce/TestGoraInputFormat.java b/gora-core/src/test/java/org/apache/gora/mapreduce/TestGoraInputFormat.java
index 74512b0..7e44d8d 100644
--- a/gora-core/src/test/java/org/apache/gora/mapreduce/TestGoraInputFormat.java
+++ b/gora-core/src/test/java/org/apache/gora/mapreduce/TestGoraInputFormat.java
@@ -54,7 +54,7 @@ public class TestGoraInputFormat {
     GoraInputFormat.setInput(job, query, false);
 
     GoraInputFormat<String, MockPersistent> inputFormat
-      = new GoraInputFormat<String, MockPersistent>();
+      = new GoraInputFormat<>();
 
     inputFormat.setConf(job.getConfiguration());
 

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-core/src/test/java/org/apache/gora/memory/store/MemStoreTest.java
----------------------------------------------------------------------
diff --git a/gora-core/src/test/java/org/apache/gora/memory/store/MemStoreTest.java b/gora-core/src/test/java/org/apache/gora/memory/store/MemStoreTest.java
index f715280..3007298 100644
--- a/gora-core/src/test/java/org/apache/gora/memory/store/MemStoreTest.java
+++ b/gora-core/src/test/java/org/apache/gora/memory/store/MemStoreTest.java
@@ -12,7 +12,7 @@ public class MemStoreTest {
 
   @Test
   public void testGetMissingValue() {
-    DataStore<String, WebPage> store = new MemStore<String, WebPage>();
+    DataStore<String, WebPage> store = new MemStore<>();
     WebPage nullWebPage = store.get("missing", new String[0]);
     assertNull(nullWebPage);
     store.close();
@@ -21,7 +21,7 @@ public class MemStoreTest {
   @Test
   public void testPutGet() throws Exception {
     String key = "org.apache.gora:http:/";
-    DataStore<String, WebPage> store = new MemStore<String, WebPage>();
+    DataStore<String, WebPage> store = new MemStore<>();
     assumeTrue(store.get(key, new String[0]) == null);
     store.put(key, WebPage.newBuilder().build());
     assertNotNull(store.get(key, new String[0]));

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-core/src/test/java/org/apache/gora/mock/store/MockDataStore.java
----------------------------------------------------------------------
diff --git a/gora-core/src/test/java/org/apache/gora/mock/store/MockDataStore.java b/gora-core/src/test/java/org/apache/gora/mock/store/MockDataStore.java
index 6bdd1ee..7a7bc93 100644
--- a/gora-core/src/test/java/org/apache/gora/mock/store/MockDataStore.java
+++ b/gora-core/src/test/java/org/apache/gora/mock/store/MockDataStore.java
@@ -111,10 +111,10 @@ public class MockDataStore extends DataStoreBase<String, MockPersistent> {
       Query<String, MockPersistent> query) throws IOException {
 
     ArrayList<PartitionQuery<String, MockPersistent>> list =
-      new ArrayList<PartitionQuery<String,MockPersistent>>();
+      new ArrayList<>();
 
     for(int i=0; i<NUM_PARTITIONS; i++) {
-      list.add(new PartitionQueryImpl<String, MockPersistent>(query, LOCATIONS[i]));
+      list.add(new PartitionQueryImpl<>(query, LOCATIONS[i]));
     }
 
     return list;

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-core/src/test/java/org/apache/gora/query/impl/TestPartitionQueryImpl.java
----------------------------------------------------------------------
diff --git a/gora-core/src/test/java/org/apache/gora/query/impl/TestPartitionQueryImpl.java b/gora-core/src/test/java/org/apache/gora/query/impl/TestPartitionQueryImpl.java
index 316684b..8975f46 100644
--- a/gora-core/src/test/java/org/apache/gora/query/impl/TestPartitionQueryImpl.java
+++ b/gora-core/src/test/java/org/apache/gora/query/impl/TestPartitionQueryImpl.java
@@ -40,7 +40,7 @@ public class TestPartitionQueryImpl {
     baseQuery.setLimit(42);
     
     PartitionQueryImpl<String, MockPersistent> 
-      query = new PartitionQueryImpl<String, MockPersistent>(baseQuery);
+      query = new PartitionQueryImpl<>(baseQuery);
     
     TestWritable.testWritable(query);
   }

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java
----------------------------------------------------------------------
diff --git a/gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java b/gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java
index 13ab390..0d4a0e6 100644
--- a/gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java
+++ b/gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java
@@ -215,12 +215,12 @@ public class DataStoreTestUtil {
     throws Exception {
 
     Employee employee = DataStoreTestUtil.createEmployee(dataStore);
-    WebPage webpage = new BeanFactoryImpl<String,WebPage>(String.class,WebPage.class).newPersistent() ;
+    WebPage webpage = new BeanFactoryImpl<>(String.class,WebPage.class).newPersistent() ;
     
     webpage.setUrl(new Utf8("url..")) ;
     webpage.setContent(ByteBuffer.wrap("test content".getBytes(Charset.defaultCharset()))) ;
     webpage.setParsedContent(new ArrayList<CharSequence>());
-    Metadata metadata = new BeanFactoryImpl<String,Metadata>(String.class,Metadata.class).newPersistent();
+    Metadata metadata = new BeanFactoryImpl<>(String.class,Metadata.class).newPersistent();
     webpage.setMetadata(metadata) ;
     employee.setWebpage(webpage) ;
     
@@ -541,9 +541,9 @@ public class DataStoreTestUtil {
     String anchor = "anchor";
 
     // putting evens
-    for (int i = 0; i < urls.length; i++) {
+    for (String url : urls) {
       WebPage webPage = WebPage.newBuilder().build();
-      webPage.setUrl(new Utf8(urls[i]));
+      webPage.setUrl(new Utf8(url));
       for (int j = 0; j < urls.length; j += 2) {
         webPage.getOutlinks().put(new Utf8(anchor + j), new Utf8(urls[j]));
       }
@@ -552,8 +552,8 @@ public class DataStoreTestUtil {
     dataStore.flush();
 
     // putting odds
-    for (int i = 0; i < urls.length; i++) {
-      WebPage webPage = dataStore.get(urls[i]);
+    for (String url : urls) {
+      WebPage webPage = dataStore.get(url);
       webPage.getOutlinks().clear();
       for (int j = 1; j < urls.length; j += 2) {
         webPage.getOutlinks().put(new Utf8(anchor + j), new Utf8(urls[j]));
@@ -566,8 +566,8 @@ public class DataStoreTestUtil {
     }
     dataStore.flush();
 
-    for (int i = 0; i < urls.length; i++) {
-      WebPage webPage = dataStore.get(urls[i]);
+    for (String url : urls) {
+      WebPage webPage = dataStore.get(url);
       int count = 0;
       for (int j = 1; j < urls.length; j += 2) {
         CharSequence link = webPage.getOutlinks().get(new Utf8(anchor + j));
@@ -589,10 +589,10 @@ public class DataStoreTestUtil {
     String[] headers = { "firstHeader", "secondHeader", "thirdHeader",
         "fourthHeader", "fifthHeader", "sixthHeader" };
 
-    for (int i = 0; i < urls.length; i++) {
+    for (String url : urls) {
       WebPage webPage = WebPage.newBuilder().build();
-      webPage.setUrl(new Utf8(urls[i]));
-      //test put for nullable map field 
+      webPage.setUrl(new Utf8(url));
+      //test put for nullable map field
       // we put data to the 'headers' field which is a Map with default value of 'null'
       webPage.setHeaders(new HashMap<CharSequence, CharSequence>());
       for (int j = 0; j < headers.length; j += 2) {
@@ -603,8 +603,8 @@ public class DataStoreTestUtil {
 
     dataStore.flush();
 
-    for (int i = 0; i < urls.length; i++) {
-      WebPage webPage = dataStore.get(urls[i]);
+    for (String url : urls) {
+      WebPage webPage = dataStore.get(url);
       //webPage.getHeaders().clear(); //TODO clear method does not work
       webPage.setHeaders(new HashMap<CharSequence, CharSequence>());
       for (int j = 1; j < headers.length; j += 2) {
@@ -615,8 +615,8 @@ public class DataStoreTestUtil {
 
     dataStore.flush();
 
-    for (int i = 0; i < urls.length; i++) {
-      WebPage webPage = dataStore.get(urls[i]);
+    for (String url : urls) {
+      WebPage webPage = dataStore.get(url);
       int count = 0;
       for (int j = 1; j < headers.length; j += 2) {
         CharSequence headerSample = webPage.getHeaders().get(new Utf8(header + j));
@@ -636,9 +636,9 @@ public class DataStoreTestUtil {
         "http://d.com/d", "http://e.com/e", "http://f.com/f", "http://g.com/g" };
     String anchor = "anchor";
 
-    for (int i = 0; i < urls.length; i++) {
+    for (String url : urls) {
       WebPage webPage = WebPage.newBuilder().build();
-      webPage.setUrl(new Utf8(urls[i]));
+      webPage.setUrl(new Utf8(url));
       for (int j = 0; j < urls.length; j++) {
         webPage.getOutlinks().put(new Utf8(anchor + j), new Utf8(urls[j]));
       }
@@ -648,8 +648,8 @@ public class DataStoreTestUtil {
     dataStore.flush();
 
     // map entry removal test
-    for (int i = 0; i < urls.length; i++) {
-      WebPage webPage = dataStore.get(urls[i]);
+    for (String url : urls) {
+      WebPage webPage = dataStore.get(url);
       for (int j = 1; j < urls.length; j += 2) {
         webPage.getOutlinks().remove(new Utf8(anchor + j));
       }
@@ -658,9 +658,9 @@ public class DataStoreTestUtil {
 
     dataStore.flush();
 
-    for (int i = 0; i < urls.length; i++) {
+    for (String url : urls) {
       int count = 0;
-      WebPage webPage = dataStore.get(urls[i]);
+      WebPage webPage = dataStore.get(url);
       for (int j = 1; j < urls.length; j += 2) {
         CharSequence link = webPage.getOutlinks().get(new Utf8(anchor + j));
         assertNull(link);
@@ -681,9 +681,9 @@ public class DataStoreTestUtil {
     String[] headers = { "firstHeader", "secondHeader", "thirdHeader",
         "fourthHeader", "fifthHeader", "sixthHeader" };
 
-    for (int i = 0; i < urls.length; i++) {
+    for (String url : urls) {
       WebPage webPage = WebPage.newBuilder().build();
-      webPage.setUrl(new Utf8(urls[i]));
+      webPage.setUrl(new Utf8(url));
       webPage.setHeaders(new HashMap<CharSequence, CharSequence>());
       for (int j = 0; j < headers.length; j++) {
         webPage.getHeaders().put(new Utf8(header + j), new Utf8(headers[j]));
@@ -694,16 +694,16 @@ public class DataStoreTestUtil {
     dataStore.flush();
 
     // nullable map field removal test
-    for (int i = 0; i < urls.length; i++) {
-      WebPage webPage = dataStore.get(urls[i]);
+    for (String url : urls) {
+      WebPage webPage = dataStore.get(url);
       webPage.setHeaders(null);
       dataStore.put(webPage.getUrl().toString(), webPage);
     }
 
     dataStore.flush();
 
-    for (int i = 0; i < urls.length; i++) {
-      WebPage webPage = dataStore.get(urls[i]);
+    for (String url : urls) {
+      WebPage webPage = dataStore.get(url);
       assertNull(webPage.getHeaders());
     }
   }
@@ -800,10 +800,8 @@ public class DataStoreTestUtil {
     createWebPageData(store);
 
     //create sorted set of urls
-    List<String> sortedUrls = new ArrayList<String>();
-    for(String url: URLS) {
-      sortedUrls.add(url);
-    }
+    List<String> sortedUrls = new ArrayList<>();
+    Collections.addAll(sortedUrls, URLS);
     Collections.sort(sortedUrls);
 
     //try all ranges
@@ -911,8 +909,8 @@ public class DataStoreTestUtil {
   throws Exception {
 
     int count = 0, partitionsCount = 0;
-    Map<String, Integer> results = new HashMap<String, Integer>();
-    Map<String, Integer> partitionResults = new HashMap<String, Integer>();
+    Map<String, Integer> results = new HashMap<>();
+    Map<String, Integer> partitionResults = new HashMap<>();
 
     //execute query and count results
     Result<String, WebPage> result = store.execute(query);
@@ -1049,18 +1047,18 @@ public class DataStoreTestUtil {
     assertNumResults(store.newQuery(), URLS.length);
 
     //assert that data is deleted
-    for (int i = 0; i < SORTED_URLS.length; i++) {
-      WebPage page = store.get(SORTED_URLS[i]);
+    for (String SORTED_URL : SORTED_URLS) {
+      WebPage page = store.get(SORTED_URL);
       assertNotNull(page);
 
       assertNotNull(page.getUrl());
-      assertEquals(page.getUrl().toString(), SORTED_URLS[i]);
+      assertEquals(page.getUrl().toString(), SORTED_URL);
       assertEquals("Map of Outlinks should have a size of '0' as the deleteByQuery "
           + "not only removes the data but also the data structure.", 0, page.getOutlinks().size());
       assertEquals(0, page.getParsedContent().size());
-      if(page.getContent() != null) {
+      if (page.getContent() != null) {
         LOG.info("url:" + page.getUrl().toString());
-        LOG.info( "limit:" + page.getContent().limit());
+        LOG.info("limit:" + page.getContent().limit());
       } else {
         assertNull(page.getContent());
       }
@@ -1189,7 +1187,7 @@ public class DataStoreTestUtil {
   
   public static String[] getFields(List<Field> schemaFields) {
     
-    List<Field> list = new ArrayList<Field>();
+    List<Field> list = new ArrayList<>();
     for (Field field : schemaFields) {
       if (!Persistent.DIRTY_BYTES_FIELD_NAME.equalsIgnoreCase(field.name())) {
         list.add(field);

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-core/src/test/java/org/apache/gora/store/TestDataStoreFactory.java
----------------------------------------------------------------------
diff --git a/gora-core/src/test/java/org/apache/gora/store/TestDataStoreFactory.java b/gora-core/src/test/java/org/apache/gora/store/TestDataStoreFactory.java
index f5e2305..1ec5d1d 100644
--- a/gora-core/src/test/java/org/apache/gora/store/TestDataStoreFactory.java
+++ b/gora-core/src/test/java/org/apache/gora/store/TestDataStoreFactory.java
@@ -94,7 +94,7 @@ public class TestDataStoreFactory {
   public void testFindProperty() {
     Properties properties = DataStoreFactory.createProps();
 
-    DataStore<String, MockPersistent> store = new DataFileAvroStore<String, MockPersistent>();
+    DataStore<String, MockPersistent> store = new DataFileAvroStore<>();
 
     String fooValue = DataStoreFactory.findProperty(properties, store,
         "foo_property", "foo_default");

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-core/src/test/java/org/apache/gora/util/TestIOUtils.java
----------------------------------------------------------------------
diff --git a/gora-core/src/test/java/org/apache/gora/util/TestIOUtils.java b/gora-core/src/test/java/org/apache/gora/util/TestIOUtils.java
index 03ccd1b..9e06557 100644
--- a/gora-core/src/test/java/org/apache/gora/util/TestIOUtils.java
+++ b/gora-core/src/test/java/org/apache/gora/util/TestIOUtils.java
@@ -159,7 +159,7 @@ public class TestIOUtils {
   
   @Test
   public void testJavaSerializableSerde() throws Exception {
-    Integer integer = Integer.valueOf(42);
+    Integer integer = 42;
     testSerializeDeserialize(integer);
   }
   
@@ -194,7 +194,7 @@ public class TestIOUtils {
   public void testReadWriteNullFieldsInfo() throws IOException {
 
     Integer n = null; //null
-    Integer nn = new Integer(42); //not null
+    Integer nn = 42; //not null
 
     testNullFieldsWith(nn);
     testNullFieldsWith(n);

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-goraci/src/main/java/org/apache/gora/goraci/Generator.java
----------------------------------------------------------------------
diff --git a/gora-goraci/src/main/java/org/apache/gora/goraci/Generator.java b/gora-goraci/src/main/java/org/apache/gora/goraci/Generator.java
index e3b86cd..c13f4c9 100644
--- a/gora-goraci/src/main/java/org/apache/gora/goraci/Generator.java
+++ b/gora-goraci/src/main/java/org/apache/gora/goraci/Generator.java
@@ -141,7 +141,7 @@ public class Generator extends Configured implements Tool {
     public List<InputSplit> getSplits(JobContext job) throws IOException, InterruptedException {
       int numMappers = job.getConfiguration().getInt("org.apache.gora.goraci.generator.mappers", 1);
       
-      ArrayList<InputSplit> splits = new ArrayList<InputSplit>(numMappers);
+      ArrayList<InputSplit> splits = new ArrayList<>(numMappers);
       
       for (int i = 0; i < numMappers; i++) {
         splits.add(new GeneratorInputSplit());

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-goraci/src/main/java/org/apache/gora/goraci/Verify.java
----------------------------------------------------------------------
diff --git a/gora-goraci/src/main/java/org/apache/gora/goraci/Verify.java b/gora-goraci/src/main/java/org/apache/gora/goraci/Verify.java
index b2e64f3..181e4b6 100644
--- a/gora-goraci/src/main/java/org/apache/gora/goraci/Verify.java
+++ b/gora-goraci/src/main/java/org/apache/gora/goraci/Verify.java
@@ -77,7 +77,7 @@ public class Verify extends Configured implements Tool {
       String[] entries = context.getConfiguration().getStrings("org.apache.gora.goraci.verify.flushed");
       
       if (entries != null && entries.length > 0) {
-        flushed = new HashMap<Utf8,Long>();
+        flushed = new HashMap<>();
         for (String entry : entries) {
           String[] kv = entry.split(":");
           flushed.put(new Utf8(kv[0]), Long.parseLong(kv[1]));
@@ -111,7 +111,7 @@ public class Verify extends Configured implements Tool {
   }
   
   public static class VerifyReducer extends Reducer<LongWritable,VLongWritable,Text,Text> {
-    private ArrayList<Long> refs = new ArrayList<Long>();
+    private ArrayList<Long> refs = new ArrayList<>();
     
     public void reduce(LongWritable key, Iterable<VLongWritable> values, Context context) throws IOException, InterruptedException {
       
@@ -245,7 +245,7 @@ public class Verify extends Configured implements Tool {
     Query<Utf8,Flushed> query = flushedTable.newQuery();
     Result<Utf8,Flushed> result = flushedTable.execute(query);
     
-    ArrayList<String> flushedEntries = new ArrayList<String>();
+    ArrayList<String> flushedEntries = new ArrayList<>();
     while (result.next()) {
       flushedEntries.add(result.getKey() + ":" + result.get().getCount());
     }

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseMapping.java
----------------------------------------------------------------------
diff --git a/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseMapping.java b/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseMapping.java
index 28d4cf1..d4cd449 100644
--- a/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseMapping.java
+++ b/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseMapping.java
@@ -66,9 +66,9 @@ public class HBaseMapping {
    */
   public static class HBaseMappingBuilder { 
     private Map<String, Map<String, HColumnDescriptor>> tableToFamilies = 
-      new HashMap<String, Map<String, HColumnDescriptor>>();
+      new HashMap<>();
     private Map<String, HBaseColumn> columnMap = 
-      new HashMap<String, HBaseColumn>();
+      new HashMap<>();
     
     private TableName tableName;
     
@@ -148,7 +148,7 @@ public class HBaseMapping {
       Map<String, HColumnDescriptor> families;
       families = tableToFamilies.get(tableName);
       if (families == null) {
-        families = new HashMap<String, HColumnDescriptor>();
+        families = new HashMap<>();
         tableToFamilies.put(tableName, families);
       }
       return families;

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java
----------------------------------------------------------------------
diff --git a/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java b/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java
index f8e82d0..c294691 100644
--- a/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java
+++ b/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java
@@ -114,7 +114,7 @@ implements Configurable {
       this.conf = HBaseConfiguration.create(getConf());
       admin = new HBaseAdmin(this.conf);
       mapping = readMapping(getConf().get(PARSE_MAPPING_FILE_KEY, DEFAULT_MAPPING_FILE));
-      filterUtil = new HBaseFilterUtil<K, T>(this.conf);
+      filterUtil = new HBaseFilterUtil<>(this.conf);
     } catch (FileNotFoundException ex) {
       try {
         mapping = readMapping(getConf().get(PARSE_MAPPING_FILE_KEY, DEPRECATED_MAPPING_FILE));
@@ -357,7 +357,7 @@ implements Configurable {
   
       org.apache.gora.query.Result<K, T> result = null;
       result = query.execute();
-      ArrayList<Delete> deletes = new ArrayList<Delete>();
+      ArrayList<Delete> deletes = new ArrayList<>();
       while(result.next()) {
         Delete delete = new Delete(toBytes(result.getKey()));
         deletes.add(delete);
@@ -384,7 +384,7 @@ implements Configurable {
 
   @Override
   public Query<K, T> newQuery() {
-    return new HBaseQuery<K, T>(this);
+    return new HBaseQuery<>(this);
   }
 
   @Override
@@ -400,7 +400,7 @@ implements Configurable {
     if (table == null) {
       throw new IOException("No table was provided.");
     }
-    List<PartitionQuery<K,T>> partitions = new ArrayList<PartitionQuery<K,T>>(keys.getFirst().length);
+    List<PartitionQuery<K,T>> partitions = new ArrayList<>(keys.getFirst().length);
     for (int i = 0; i < keys.getFirst().length; i++) {
       String regionLocation = table.getRegionLocation(keys.getFirst()[i]).getHostname();
       byte[] startRow = query.getStartKey() != null ? toBytes(query.getStartKey())
@@ -427,7 +427,7 @@ implements Configurable {
         K endKey = Arrays.equals(HConstants.EMPTY_END_ROW, splitStop) ?
             null : HBaseByteInterface.fromBytes(keyClass, splitStop);
 
-        PartitionQueryImpl<K, T> partition = new PartitionQueryImpl<K, T>(
+        PartitionQueryImpl<K, T> partition = new PartitionQueryImpl<>(
             query, startKey, endKey, regionLocation);
         partition.setConf(getConf());
 
@@ -449,12 +449,12 @@ implements Configurable {
         addFields(get, query.getFields());
         addTimeRange(get, query);
         Result result = table.get(get);
-        return new HBaseGetResult<K,T>(this, query, result);
+        return new HBaseGetResult<>(this, query, result);
       } else {
         ResultScanner scanner = createScanner(query);
   
         org.apache.gora.query.Result<K,T> result
-            = new HBaseScannerResult<K,T>(this, query, scanner);
+            = new HBaseScannerResult<>(this, query, scanner);
   
         return result;
       }
@@ -642,7 +642,7 @@ implements Configurable {
         return;
       }
       Schema valueSchema = fieldSchema.getValueType();
-      Map<Utf8, Object> map = new HashMap<Utf8, Object>();
+      Map<Utf8, Object> map = new HashMap<>();
       for (Entry<byte[], byte[]> e : qualMap.entrySet()) {
         map.put(new Utf8(Bytes.toString(e.getKey())),
             fromBytes(valueSchema, e.getValue()));
@@ -655,8 +655,8 @@ implements Configurable {
         return;
       }
       valueSchema = fieldSchema.getElementType();
-      ArrayList<Object> arrayList = new ArrayList<Object>();
-      DirtyListWrapper<Object> dirtyListWrapper = new DirtyListWrapper<Object>(arrayList);
+      ArrayList<Object> arrayList = new ArrayList<>();
+      DirtyListWrapper<Object> dirtyListWrapper = new DirtyListWrapper<>(arrayList);
       for (Entry<byte[], byte[]> e : qualMap.entrySet()) {
         dirtyListWrapper.add(fromBytes(valueSchema, e.getValue()));
       }

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseTableConnection.java
----------------------------------------------------------------------
diff --git a/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseTableConnection.java b/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseTableConnection.java
index 0f625ff..6803827 100644
--- a/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseTableConnection.java
+++ b/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseTableConnection.java
@@ -68,7 +68,7 @@ public class HBaseTableConnection implements HTableInterface {
   
   private final Configuration conf;
   private final ThreadLocal<HTable> tables;
-  private final BlockingQueue<HTable> pool = new LinkedBlockingQueue<HTable>();
+  private final BlockingQueue<HTable> pool = new LinkedBlockingQueue<>();
   private final boolean autoFlush;
   private final TableName tableName;
   
@@ -83,7 +83,7 @@ public class HBaseTableConnection implements HTableInterface {
   public HBaseTableConnection(Configuration conf, String tableName, boolean autoflush)
       throws IOException {
     this.conf = conf;
-    this.tables = new ThreadLocal<HTable>();
+    this.tables = new ThreadLocal<>();
     this.tableName = TableName.valueOf(tableName);
     this.autoFlush = autoflush;
   }

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-hbase/src/main/java/org/apache/gora/hbase/util/DefaultFactory.java
----------------------------------------------------------------------
diff --git a/gora-hbase/src/main/java/org/apache/gora/hbase/util/DefaultFactory.java b/gora-hbase/src/main/java/org/apache/gora/hbase/util/DefaultFactory.java
index 43f4bd2..de26e58 100644
--- a/gora-hbase/src/main/java/org/apache/gora/hbase/util/DefaultFactory.java
+++ b/gora-hbase/src/main/java/org/apache/gora/hbase/util/DefaultFactory.java
@@ -40,7 +40,7 @@ public class DefaultFactory <K, T extends PersistentBase> extends BaseFactory<K,
   
   @Override
   public List<String> getSupportedFilters() {
-    List<String> filters = new ArrayList<String>();
+    List<String> filters = new ArrayList<>();
     filters.add(SingleFieldValueFilter.class.getCanonicalName());
     filters.add(MapFieldValueFilter.class.getCanonicalName());
     filters.add(FilterList.class.getCanonicalName());

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-hbase/src/main/java/org/apache/gora/hbase/util/HBaseByteInterface.java
----------------------------------------------------------------------
diff --git a/gora-hbase/src/main/java/org/apache/gora/hbase/util/HBaseByteInterface.java b/gora-hbase/src/main/java/org/apache/gora/hbase/util/HBaseByteInterface.java
index 5256e37..c20383b 100644
--- a/gora-hbase/src/main/java/org/apache/gora/hbase/util/HBaseByteInterface.java
+++ b/gora-hbase/src/main/java/org/apache/gora/hbase/util/HBaseByteInterface.java
@@ -46,12 +46,12 @@ public class HBaseByteInterface {
    * Threadlocals maintaining reusable binary decoders and encoders.
    */
   private static ThreadLocal<ByteArrayOutputStream> outputStream =
-      new ThreadLocal<ByteArrayOutputStream>();
+      new ThreadLocal<>();
   
   public static final ThreadLocal<BinaryDecoder> decoders =
-      new ThreadLocal<BinaryDecoder>();
+      new ThreadLocal<>();
   public static final ThreadLocal<BinaryEncoder> encoders =
-      new ThreadLocal<BinaryEncoder>();
+      new ThreadLocal<>();
   /*
    * Create a threadlocal map for the datum readers and writers, because
    * they are not thread safe, at least not before Avro 1.4.0 (See AVRO-650).
@@ -60,10 +60,10 @@ public class HBaseByteInterface {
    */
   
   public static final ConcurrentHashMap<String, SpecificDatumReader<?>> readerMap = 
-      new ConcurrentHashMap<String, SpecificDatumReader<?>>();
+      new ConcurrentHashMap<>();
      
   public static final ConcurrentHashMap<String, SpecificDatumWriter<?>> writerMap = 
-      new ConcurrentHashMap<String, SpecificDatumWriter<?>>();
+      new ConcurrentHashMap<>();
 
   /**
    * Deserializes an array of bytes matching the given schema to the proper basic 

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-hbase/src/main/java/org/apache/gora/hbase/util/HBaseFilterUtil.java
----------------------------------------------------------------------
diff --git a/gora-hbase/src/main/java/org/apache/gora/hbase/util/HBaseFilterUtil.java b/gora-hbase/src/main/java/org/apache/gora/hbase/util/HBaseFilterUtil.java
index 6e26607..c850fd7 100644
--- a/gora-hbase/src/main/java/org/apache/gora/hbase/util/HBaseFilterUtil.java
+++ b/gora-hbase/src/main/java/org/apache/gora/hbase/util/HBaseFilterUtil.java
@@ -33,7 +33,7 @@ import java.util.Map;
 public class HBaseFilterUtil<K, T extends PersistentBase> {
   private static final Log LOG = LogFactory.getLog(HBaseFilterUtil.class);
 
-  private Map<String, FilterFactory<K, T>> factories = new LinkedHashMap<String, FilterFactory<K, T>>();
+  private Map<String, FilterFactory<K, T>> factories = new LinkedHashMap<>();
 
   public HBaseFilterUtil(Configuration conf) throws GoraException {
     String[] factoryClassNames = conf.getStrings("gora.hbase.filter.factories", "org.apache.gora.hbase.util.DefaultFactory");

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-hbase/src/test/java/org/apache/gora/hbase/util/TestHBaseByteInterface.java
----------------------------------------------------------------------
diff --git a/gora-hbase/src/test/java/org/apache/gora/hbase/util/TestHBaseByteInterface.java b/gora-hbase/src/test/java/org/apache/gora/hbase/util/TestHBaseByteInterface.java
index e25a267..7333342 100644
--- a/gora-hbase/src/test/java/org/apache/gora/hbase/util/TestHBaseByteInterface.java
+++ b/gora-hbase/src/test/java/org/apache/gora/hbase/util/TestHBaseByteInterface.java
@@ -75,7 +75,7 @@ public class TestHBaseByteInterface {
       //metadata
       CharSequence key = new Utf8("theKey");
       CharSequence value = new Utf8("theValue " + RANDOM.nextLong());
-      HashMap<CharSequence, CharSequence> data = new HashMap<CharSequence, CharSequence>();
+      HashMap<CharSequence, CharSequence> data = new HashMap<>();
       data.put(key, value);
       Metadata m = Metadata.newBuilder().build();
       m.setData(data);
@@ -95,7 +95,7 @@ public class TestHBaseByteInterface {
     ExecutorService pool = Executors.newFixedThreadPool(numThreads);
 
     // define a list of tasks
-    Collection<Callable<Integer>> tasks = new ArrayList<Callable<Integer>>();
+    Collection<Callable<Integer>> tasks = new ArrayList<>();
     for (int i = 0; i < numThreads; i++) {
       tasks.add(new Callable<Integer>() {
         @Override

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-mongodb/src/main/java/org/apache/gora/mongodb/filters/DefaultFactory.java
----------------------------------------------------------------------
diff --git a/gora-mongodb/src/main/java/org/apache/gora/mongodb/filters/DefaultFactory.java b/gora-mongodb/src/main/java/org/apache/gora/mongodb/filters/DefaultFactory.java
index 1e697f2..597f7e9 100644
--- a/gora-mongodb/src/main/java/org/apache/gora/mongodb/filters/DefaultFactory.java
+++ b/gora-mongodb/src/main/java/org/apache/gora/mongodb/filters/DefaultFactory.java
@@ -37,7 +37,7 @@ public class DefaultFactory<K, T extends PersistentBase> extends
 
   @Override
   public List<String> getSupportedFilters() {
-    List<String> filters = new ArrayList<String>();
+    List<String> filters = new ArrayList<>();
     filters.add(SingleFieldValueFilter.class.getCanonicalName());
     filters.add(MapFieldValueFilter.class.getCanonicalName());
     filters.add(FilterList.class.getCanonicalName());
@@ -158,7 +158,7 @@ public class DefaultFactory<K, T extends PersistentBase> extends
    * @see <a href="https://issues.apache.org/jira/browse/GORA-388">GORA-388</a>
    */
   private List<String> convertOperandsToString(List<Object> rawOperands) {
-    List<String> operands = new ArrayList<String>(rawOperands.size());
+    List<String> operands = new ArrayList<>(rawOperands.size());
     for (Object rawOperand : rawOperands) {
       if (rawOperand != null) {
         operands.add(rawOperand.toString());

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-mongodb/src/main/java/org/apache/gora/mongodb/filters/MongoFilterUtil.java
----------------------------------------------------------------------
diff --git a/gora-mongodb/src/main/java/org/apache/gora/mongodb/filters/MongoFilterUtil.java b/gora-mongodb/src/main/java/org/apache/gora/mongodb/filters/MongoFilterUtil.java
index 126dc4c..96a4ef1 100644
--- a/gora-mongodb/src/main/java/org/apache/gora/mongodb/filters/MongoFilterUtil.java
+++ b/gora-mongodb/src/main/java/org/apache/gora/mongodb/filters/MongoFilterUtil.java
@@ -60,7 +60,7 @@ public class MongoFilterUtil<K, T extends PersistentBase> {
    */
   private static final Log LOG = LogFactory.getLog(MongoFilterUtil.class);
 
-  private Map<String, FilterFactory<K, T>> factories = new LinkedHashMap<String, FilterFactory<K, T>>();
+  private Map<String, FilterFactory<K, T>> factories = new LinkedHashMap<>();
 
   public MongoFilterUtil(final Configuration conf) throws GoraException {
     String[] factoryClassNames = conf.getStrings(

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-mongodb/src/main/java/org/apache/gora/mongodb/store/MongoMapping.java
----------------------------------------------------------------------
diff --git a/gora-mongodb/src/main/java/org/apache/gora/mongodb/store/MongoMapping.java b/gora-mongodb/src/main/java/org/apache/gora/mongodb/store/MongoMapping.java
index 7f754ff..17f5d83 100644
--- a/gora-mongodb/src/main/java/org/apache/gora/mongodb/store/MongoMapping.java
+++ b/gora-mongodb/src/main/java/org/apache/gora/mongodb/store/MongoMapping.java
@@ -52,17 +52,17 @@ public class MongoMapping {
   /**
    * Mapping between the class fields and the Mongo document fields
    */
-  private HashMap<String, String> classToDocument = new HashMap<String, String>();
+  private HashMap<String, String> classToDocument = new HashMap<>();
 
   /**
    * Mapping between the Mongo document fields and the class fields
    */
-  private HashMap<String, String> documentToClass = new HashMap<String, String>();
+  private HashMap<String, String> documentToClass = new HashMap<>();
 
   /**
    * Mongo document description
    */
-  private HashMap<String, DocumentFieldType> documentFields = new HashMap<String, DocumentFieldType>();
+  private HashMap<String, DocumentFieldType> documentFields = new HashMap<>();
 
   /**
    * Change the name of the collection.

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-mongodb/src/main/java/org/apache/gora/mongodb/store/MongoStore.java
----------------------------------------------------------------------
diff --git a/gora-mongodb/src/main/java/org/apache/gora/mongodb/store/MongoStore.java b/gora-mongodb/src/main/java/org/apache/gora/mongodb/store/MongoStore.java
index ebaf010..8e34776 100644
--- a/gora-mongodb/src/main/java/org/apache/gora/mongodb/store/MongoStore.java
+++ b/gora-mongodb/src/main/java/org/apache/gora/mongodb/store/MongoStore.java
@@ -80,7 +80,7 @@ public class MongoStore<K, T extends PersistentBase> extends
   /**
    * MongoDB client
    */
-  private static ConcurrentHashMap<String, MongoClient> mapsOfClients = new ConcurrentHashMap<String, MongoClient>();
+  private static ConcurrentHashMap<String, MongoClient> mapsOfClients = new ConcurrentHashMap<>();
 
   private DB mongoClientDB;
 
@@ -109,10 +109,10 @@ public class MongoStore<K, T extends PersistentBase> extends
       MongoStoreParameters parameters = MongoStoreParameters.load(properties, getConf());
       super.initialize(keyClass, pPersistentClass, properties);
 
-      filterUtil = new MongoFilterUtil<K, T>(getConf());
+      filterUtil = new MongoFilterUtil<>(getConf());
 
       // Load the mapping
-      MongoMappingBuilder<K, T> builder = new MongoMappingBuilder<K, T>(this);
+      MongoMappingBuilder<K, T> builder = new MongoMappingBuilder<>(this);
       LOG.debug("Initializing Mongo store with mapping {}.",
           new Object[] { parameters.getMappingFile() });
       builder.fromFile(parameters.getMappingFile());
@@ -156,11 +156,11 @@ public class MongoStore<K, T extends PersistentBase> extends
     // If configuration contains a login + secret, try to authenticated with DB
     List<MongoCredential> credentials = null;
     if (params.getLogin() != null && params.getSecret() != null) {
-      credentials = new ArrayList<MongoCredential>();
+      credentials = new ArrayList<>();
       credentials.add(MongoCredential.createCredential(params.getLogin(), params.getDbname(), params.getSecret().toCharArray()));
     }
     // Build server address
-    List<ServerAddress> addrs = new ArrayList<ServerAddress>();
+    List<ServerAddress> addrs = new ArrayList<>();
     Iterable<String> serversArray = Splitter.on(",").split(params.getServers());
     if (serversArray != null) {
       for (String server : serversArray) {
@@ -410,7 +410,7 @@ public class MongoStore<K, T extends PersistentBase> extends
     cursor.addOption(Bytes.QUERYOPTION_NOTIMEOUT);
 
     // Build the result
-    MongoDBResult<K, T> mongoResult = new MongoDBResult<K, T>(this, query);
+    MongoDBResult<K, T> mongoResult = new MongoDBResult<>(this, query);
     mongoResult.setCursor(cursor);
 
     return mongoResult;
@@ -421,7 +421,7 @@ public class MongoStore<K, T extends PersistentBase> extends
    */
   @Override
   public Query<K, T> newQuery() {
-    MongoDBQuery<K, T> query = new MongoDBQuery<K, T>(this);
+    MongoDBQuery<K, T> query = new MongoDBQuery<>(this);
     query.setFields(getFieldsToQuery(null));
     return query;
   }
@@ -435,8 +435,8 @@ public class MongoStore<K, T extends PersistentBase> extends
       throws IOException {
     // FIXME: for now, there is only one partition as we do not handle
     // MongoDB sharding configuration
-    List<PartitionQuery<K, T>> partitions = new ArrayList<PartitionQuery<K, T>>();
-    PartitionQueryImpl<K, T> partitionQuery = new PartitionQueryImpl<K, T>(
+    List<PartitionQuery<K, T>> partitions = new ArrayList<>();
+    PartitionQueryImpl<K, T> partitionQuery = new PartitionQueryImpl<>(
         query);
     partitionQuery.setConf(getConf());
     partitions.add(partitionQuery);
@@ -603,7 +603,7 @@ public class MongoStore<K, T extends PersistentBase> extends
   /* pp */ Object fromMongoList(final String docf, final Schema fieldSchema,
                        final BSONDecorator easybson, final Field f) {
     List<Object> list = easybson.getDBList(docf);
-    List<Object> rlist = new ArrayList<Object>();
+    List<Object> rlist = new ArrayList<>();
     if (list == null) {
       return new DirtyListWrapper(rlist);
     }
@@ -615,13 +615,13 @@ public class MongoStore<K, T extends PersistentBase> extends
           "item", new BSONDecorator(new BasicDBObject("item", item)));
       rlist.add(o);
     }
-    return new DirtyListWrapper<Object>(rlist);
+    return new DirtyListWrapper<>(rlist);
   }
 
   /* pp */ Object fromMongoMap(final String docf, final Schema fieldSchema,
                       final BSONDecorator easybson, final Field f) {
     BasicDBObject map = easybson.getDBObject(docf);
-    Map<Utf8, Object> rmap = new HashMap<Utf8, Object>();
+    Map<Utf8, Object> rmap = new HashMap<>();
     if (map == null) {
         return new DirtyMapWrapper(rmap);
     }
@@ -634,7 +634,7 @@ public class MongoStore<K, T extends PersistentBase> extends
           new BSONDecorator(map));
       rmap.put(new Utf8(decodedMapKey), o);
     }
-    return new DirtyMapWrapper<Utf8, Object>(rmap);
+    return new DirtyMapWrapper<>(rmap);
   }
 
   private Object fromMongoString(final DocumentFieldType storeType,

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-mongodb/src/test/java/org/apache/gora/mongodb/filters/DefaultFactoryTest.java
----------------------------------------------------------------------
diff --git a/gora-mongodb/src/test/java/org/apache/gora/mongodb/filters/DefaultFactoryTest.java b/gora-mongodb/src/test/java/org/apache/gora/mongodb/filters/DefaultFactoryTest.java
index b6642b9..bb0f06d 100644
--- a/gora-mongodb/src/test/java/org/apache/gora/mongodb/filters/DefaultFactoryTest.java
+++ b/gora-mongodb/src/test/java/org/apache/gora/mongodb/filters/DefaultFactoryTest.java
@@ -39,12 +39,12 @@ public class DefaultFactoryTest {
 
   @Before
   public void setUp() throws Exception {
-    filterFactory = new DefaultFactory<String, WebPage>();
+    filterFactory = new DefaultFactory<>();
     filterFactory.setFilterUtil(new MongoFilterUtil<String, WebPage>(
         new Configuration()));
 
     // Create dummy mapping for unit testing
-    store = new MongoStore<String, WebPage>();
+    store = new MongoStore<>();
     store.getMapping().addClassField(null, "headers", "h", "document");
     store.getMapping().addClassField(null, "url", "url", "string");
   }
@@ -97,7 +97,7 @@ public class DefaultFactoryTest {
 
   @Test
   public void testCreateFilter_list_empty() throws Exception {
-    FilterList<String, WebPage> filter = new FilterList<String, WebPage>();
+    FilterList<String, WebPage> filter = new FilterList<>();
 
     DBObject dbObject = filterFactory.createFilter(filter, store);
     assertEquals("{ }", dbObject.toString());
@@ -105,7 +105,7 @@ public class DefaultFactoryTest {
 
   @Test
   public void testCreateFilter_list_2() throws Exception {
-    FilterList<String, WebPage> filter = new FilterList<String, WebPage>();
+    FilterList<String, WebPage> filter = new FilterList<>();
     MapFieldValueFilter<String, WebPage> hFilter = createHeadersFilter();
     hFilter.setFilterIfMissing(true);
     hFilter.setFilterOp(FilterOp.EQUALS);
@@ -127,7 +127,7 @@ public class DefaultFactoryTest {
    */
   @Test
   public void testCreateFilter_handlingUtf8() throws Exception {
-    SingleFieldValueFilter<String, WebPage> filter = new SingleFieldValueFilter<String, WebPage>();
+    SingleFieldValueFilter<String, WebPage> filter = new SingleFieldValueFilter<>();
     filter.setFieldName(WebPage.Field.URL.toString());
     filter.setFilterOp(FilterOp.EQUALS);
     filter.getOperands().add(new Utf8("http://www.example.com"));
@@ -139,7 +139,7 @@ public class DefaultFactoryTest {
   }
 
   private MapFieldValueFilter<String, WebPage> createHeadersFilter() {
-    MapFieldValueFilter<String, WebPage> filter = new MapFieldValueFilter<String, WebPage>();
+    MapFieldValueFilter<String, WebPage> filter = new MapFieldValueFilter<>();
     filter.setFieldName(WebPage.Field.HEADERS.toString());
     filter.setMapKey(new Utf8("C.T"));
     filter.getOperands().add("text/html");
@@ -147,7 +147,7 @@ public class DefaultFactoryTest {
   }
 
   private SingleFieldValueFilter<String, WebPage> createUrlFilter() {
-    SingleFieldValueFilter<String, WebPage> filter = new SingleFieldValueFilter<String, WebPage>();
+    SingleFieldValueFilter<String, WebPage> filter = new SingleFieldValueFilter<>();
     filter.setFieldName(WebPage.Field.URL.toString());
     filter.getOperands().add("http://www.example.com");
     return filter;

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-mongodb/src/test/java/org/apache/gora/mongodb/store/TestMongoMappingBuilder.java
----------------------------------------------------------------------
diff --git a/gora-mongodb/src/test/java/org/apache/gora/mongodb/store/TestMongoMappingBuilder.java b/gora-mongodb/src/test/java/org/apache/gora/mongodb/store/TestMongoMappingBuilder.java
index cb04d46..6ba4108 100644
--- a/gora-mongodb/src/test/java/org/apache/gora/mongodb/store/TestMongoMappingBuilder.java
+++ b/gora-mongodb/src/test/java/org/apache/gora/mongodb/store/TestMongoMappingBuilder.java
@@ -29,10 +29,10 @@ public class TestMongoMappingBuilder {
 
   @Test
   public void testMultiMapping_Webpage() throws IOException {
-    MongoStore<String, WebPage> store = new MongoStore<String, WebPage>();
+    MongoStore<String, WebPage> store = new MongoStore<>();
     store.setKeyClass(String.class);
     store.setPersistentClass(WebPage.class);
-    MongoMappingBuilder<String, WebPage> builder = new MongoMappingBuilder<String, WebPage>(
+    MongoMappingBuilder<String, WebPage> builder = new MongoMappingBuilder<>(
         store);
     builder.fromFile("/multimapping.xml");
     MongoMapping mapping = builder.build();

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-shims-hadoop/src/main/java/org/apache/gora/shims/hadoop/HadoopShimFactory.java
----------------------------------------------------------------------
diff --git a/gora-shims-hadoop/src/main/java/org/apache/gora/shims/hadoop/HadoopShimFactory.java b/gora-shims-hadoop/src/main/java/org/apache/gora/shims/hadoop/HadoopShimFactory.java
index b2c5213..57533cd 100644
--- a/gora-shims-hadoop/src/main/java/org/apache/gora/shims/hadoop/HadoopShimFactory.java
+++ b/gora-shims-hadoop/src/main/java/org/apache/gora/shims/hadoop/HadoopShimFactory.java
@@ -30,7 +30,7 @@ public class HadoopShimFactory {
   /**
    * Hadoop shim version mapping.
    */
-  private static final Map<String, String> HADOOP_VERSION_TO_IMPL_MAP = new HashMap<String, String>();
+  private static final Map<String, String> HADOOP_VERSION_TO_IMPL_MAP = new HashMap<>();
 
   static {
     HADOOP_VERSION_TO_IMPL_MAP.put("1",

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-solr/src/main/java/org/apache/gora/solr/query/SolrResult.java
----------------------------------------------------------------------
diff --git a/gora-solr/src/main/java/org/apache/gora/solr/query/SolrResult.java b/gora-solr/src/main/java/org/apache/gora/solr/query/SolrResult.java
index 9480540..38c1fca 100644
--- a/gora-solr/src/main/java/org/apache/gora/solr/query/SolrResult.java
+++ b/gora-solr/src/main/java/org/apache/gora/solr/query/SolrResult.java
@@ -56,7 +56,7 @@ public class SolrResult<K, T extends PersistentBase> extends ResultBase<K, T> {
     if (fields == null) {
       params.set(CommonParams.FL, "*");
     } else {
-      HashSet<String> uniqFields = new HashSet<String>(Arrays.asList(fields));
+      HashSet<String> uniqFields = new HashSet<>(Arrays.asList(fields));
       String keyFld = ((SolrStore<K, T>)dataStore).getMapping().getPrimaryKey();
       uniqFields.add(keyFld); // return also primary key
       StringBuilder sb = new StringBuilder();

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-solr/src/main/java/org/apache/gora/solr/store/SolrMapping.java
----------------------------------------------------------------------
diff --git a/gora-solr/src/main/java/org/apache/gora/solr/store/SolrMapping.java b/gora-solr/src/main/java/org/apache/gora/solr/store/SolrMapping.java
index 65802a4..424ae71 100644
--- a/gora-solr/src/main/java/org/apache/gora/solr/store/SolrMapping.java
+++ b/gora-solr/src/main/java/org/apache/gora/solr/store/SolrMapping.java
@@ -25,7 +25,7 @@ public class SolrMapping {
   String primaryKey;
   
   public SolrMapping() {
-    mapping = new HashMap<String,String>();
+    mapping = new HashMap<>();
   }
   
   public void addField(String goraField, String solrField) {

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-solr/src/main/java/org/apache/gora/solr/store/SolrStore.java
----------------------------------------------------------------------
diff --git a/gora-solr/src/main/java/org/apache/gora/solr/store/SolrStore.java b/gora-solr/src/main/java/org/apache/gora/solr/store/SolrStore.java
index ad923b6..b437299 100644
--- a/gora-solr/src/main/java/org/apache/gora/solr/store/SolrStore.java
+++ b/gora-solr/src/main/java/org/apache/gora/solr/store/SolrStore.java
@@ -175,9 +175,9 @@ public class SolrStore<K, T extends PersistentBase> extends DataStoreBase<K, T>
    * pair for every schema, instead of one for every thread.
    */
 
-  public static final ConcurrentHashMap<String, SpecificDatumReader<?>> readerMap = new ConcurrentHashMap<String, SpecificDatumReader<?>>();
+  public static final ConcurrentHashMap<String, SpecificDatumReader<?>> readerMap = new ConcurrentHashMap<>();
 
-  public static final ConcurrentHashMap<String, SpecificDatumWriter<?>> writerMap = new ConcurrentHashMap<String, SpecificDatumWriter<?>>();
+  public static final ConcurrentHashMap<String, SpecificDatumWriter<?>> writerMap = new ConcurrentHashMap<>();
 
   @Override
   public void initialize(Class<K> keyClass, Class<T> persistentClass,
@@ -276,7 +276,7 @@ public class SolrStore<K, T extends PersistentBase> extends DataStoreBase<K, T>
         LOG.warn("Invalid batch size '{}', using default {}", batchSizeString, DEFAULT_BATCH_SIZE);
       }
     }
-    batch = new ArrayList<SolrInputDocument>(batchSize);
+    batch = new ArrayList<>(batchSize);
     String commitWithinString = DataStoreFactory.findProperty(properties, this,
         SOLR_COMMIT_WITHIN_PROPERTY, null);
     if (commitWithinString != null) {
@@ -681,9 +681,8 @@ public class SolrStore<K, T extends PersistentBase> extends DataStoreBase<K, T>
    */
   private int getUnionSchema(Object pValue, Schema pUnionSchema) {
     int unionSchemaPos = 0;
-    Iterator<Schema> it = pUnionSchema.getTypes().iterator();
-    while (it.hasNext()) {
-      Type schemaType = it.next().getType();
+    for (Schema currentSchema : pUnionSchema.getTypes()) {
+      Type schemaType = currentSchema.getType();
       if (pValue instanceof Utf8 && schemaType.equals(Type.STRING))
         return unionSchemaPos;
       else if (pValue instanceof ByteBuffer && schemaType.equals(Type.BYTES))
@@ -742,7 +741,7 @@ public class SolrStore<K, T extends PersistentBase> extends DataStoreBase<K, T>
   @Override
   public Result<K, T> execute(Query<K, T> query) {
     try {
-      return new SolrResult<K, T>(this, query, server, resultsSize);
+      return new SolrResult<>(this, query, server, resultsSize);
     } catch (IOException e) {
       LOG.error(e.getMessage(), e);
     }
@@ -751,7 +750,7 @@ public class SolrStore<K, T extends PersistentBase> extends DataStoreBase<K, T>
 
   @Override
   public Query<K, T> newQuery() {
-    return new SolrQuery<K, T>(this);
+    return new SolrQuery<>(this);
   }
 
   @Override
@@ -759,8 +758,8 @@ public class SolrStore<K, T extends PersistentBase> extends DataStoreBase<K, T>
       throws IOException {
     // TODO: implement this using Hadoop DB support
 
-    ArrayList<PartitionQuery<K, T>> partitions = new ArrayList<PartitionQuery<K, T>>();
-    PartitionQueryImpl<K, T> pqi = new PartitionQueryImpl<K, T>(query);
+    ArrayList<PartitionQuery<K, T>> partitions = new ArrayList<>();
+    PartitionQueryImpl<K, T> pqi = new PartitionQueryImpl<>(query);
     pqi.setConf(getConf());
     partitions.add(pqi);
 

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-solr/src/test/java/org/apache/gora/solr/store/TestSolrStore.java
----------------------------------------------------------------------
diff --git a/gora-solr/src/test/java/org/apache/gora/solr/store/TestSolrStore.java b/gora-solr/src/test/java/org/apache/gora/solr/store/TestSolrStore.java
index 95a7078..da33e6b 100644
--- a/gora-solr/src/test/java/org/apache/gora/solr/store/TestSolrStore.java
+++ b/gora-solr/src/test/java/org/apache/gora/solr/store/TestSolrStore.java
@@ -36,7 +36,7 @@ public class TestSolrStore extends DataStoreTestBase {
   @Override
   protected DataStore<String, Employee> createEmployeeDataStore()
       throws IOException {
-    SolrStore<String, Employee> store = new SolrStore<String, Employee>();
+    SolrStore<String, Employee> store = new SolrStore<>();
     store.initialize(String.class, Employee.class, DataStoreFactory.createProps());
     return store;
   }
@@ -44,7 +44,7 @@ public class TestSolrStore extends DataStoreTestBase {
   @Override
   protected DataStore<String, WebPage> createWebPageDataStore()
       throws IOException {
-    SolrStore<String, WebPage> store = new SolrStore<String, WebPage>();
+    SolrStore<String, WebPage> store = new SolrStore<>();
     store.initialize(String.class, WebPage.class, DataStoreFactory.createProps());
     return store;
   }

http://git-wip-us.apache.org/repos/asf/gora/blob/f681764a/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogManager.java
----------------------------------------------------------------------
diff --git a/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogManager.java b/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogManager.java
index f94d79a..f089afb 100644
--- a/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogManager.java
+++ b/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogManager.java
@@ -82,25 +82,22 @@ public class LogManager {
    */
   private void parse(String input) throws Exception {
     log.info("Parsing file: {}", input);
-    BufferedReader reader = new BufferedReader(new InputStreamReader(
-      new FileInputStream(input), Charset.defaultCharset()));
-    long lineCount = 0;
-    try {
-      String line = reader.readLine();
-      do {
-        Pageview pageview = parseLine(line);
-        
-        if(pageview != null) {
-          //store the pageview 
-          storePageview(lineCount++, pageview);
-        }
-        
-        line = reader.readLine();
-      } while(line != null);
-      
-    } finally {
-      reader.close();  
-    }
+      long lineCount = 0;
+      try (BufferedReader reader = new BufferedReader(new InputStreamReader(
+            new FileInputStream(input), Charset.defaultCharset()))) {
+        String line = reader.readLine();
+        do {
+          Pageview pageview = parseLine(line);
+
+          if (pageview != null) {
+            //store the pageview
+            storePageview(lineCount++, pageview);
+          }
+
+          line = reader.readLine();
+        } while (line != null);
+
+      }
     log.info("finished parsing file. Total number of log lines: {}", lineCount);
   }
   


Mime
View raw message