com.google.common.base.Optionaljava.util.Optional



Project Athou/commafeed in file ....com.commafeed.frontend.resource.CategoryREST.java (2014-12-12)
@@ -11,6 +11,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
+import java.util.Optional;
 import java.util.stream.Collectors;
 
 import javax.inject.Inject;
@@ -59,7 +60,6 @@ import com.commafeed.frontend.model.request.CategoryModificationRequest;
 import com.commafeed.frontend.model.request.CollapseRequest;
 import com.commafeed.frontend.model.request.IDRequest;
 import com.commafeed.frontend.model.request.MarkRequest;
-import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Lists;
 import com.rometools.rome.feed.synd.SyndFeed;
@@ -132,7 +132,7 @@ public class CategoryREST {
 		}
 
 		if (ALL.equals(id)) {
-			entries.setName(Optional.fromNullable(tag).or("All"));
+			entries.setName(Optional.ofNullable(tag).orElse("All"));
 			List<FeedSubscription> subs = feedSubscriptionDAO.findAll(user);
 			removeExcludedSubscriptions(subs, excludedIds);
 			List<FeedEntryStatus> list = feedEntryStatusDAO.findBySubscriptions(user, subs, unreadOnly, entryKeywords, newerThanDate,
Project Athou/commafeed in file ....com.commafeed.backend.feed.FeedRefreshWorker.java (2014-12-12)
@@ -4,6 +4,7 @@ import io.dropwizard.lifecycle.Managed;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Optional;
 
 import javax.inject.Inject;
 import javax.inject.Singleton;
@@ -20,7 +21,6 @@ import com.commafeed.backend.HttpGetter.NotModifiedException;
 import com.commafeed.backend.feed.FeedRefreshExecutor.Task;
 import com.commafeed.backend.model.Feed;
 import com.commafeed.backend.model.FeedEntry;
-import com.google.common.base.Optional;
 
 /**
  * Calls {@link FeedFetcher} and handles its outcome
@@ -84,7 +84,7 @@ public class FeedRefreshWorker implements Managed {
 		int refreshInterval = config.getApplicationSettings().getRefreshIntervalMinutes();
 		Date disabledUntil = DateUtils.addMinutes(new Date(), refreshInterval);
 		try {
-			String url = Optional.fromNullable(feed.getUrlAfterRedirect()).or(feed.getUrl());
+			String url = Optional.ofNullable(feed.getUrlAfterRedirect()).orElse(feed.getUrl());
 			FetchedFeed fetchedFeed = fetcher.fetch(url, false, feed.getLastModifiedHeader(), feed.getEtagHeader(),
 					feed.getLastPublishedDate(), feed.getLastContentHash());
 			// stops here if NotModifiedException or any other exception is thrown
Project Athou/commafeed in file ...ava.com.commafeed.backend.service.MailService.java (2014-12-12)
@@ -1,5 +1,6 @@
 package com.commafeed.backend.service;
 
+import java.util.Optional;
 import java.util.Properties;
 
 import javax.inject.Inject;
@@ -17,7 +18,6 @@ import lombok.RequiredArgsConstructor;
 import com.commafeed.CommaFeedConfiguration;
 import com.commafeed.CommaFeedConfiguration.ApplicationSettings;
 import com.commafeed.backend.model.User;
-import com.google.common.base.Optional;
 
 /**
  * Mailing service
@@ -35,7 +35,7 @@ public class MailService {
 
 		final String username = settings.getSmtpUserName();
 		final String password = settings.getSmtpPassword();
-		final String fromAddress = Optional.fromNullable(settings.getSmtpFromAddress()).or(settings.getSmtpUserName());
+		final String fromAddress = Optional.ofNullable(settings.getSmtpFromAddress()).orElse(settings.getSmtpUserName());
 
 		String dest = user.getEmail();
 
Project facebook/presto in file ...ok.presto.benchmark.CountAggregationBenchmark.java (2014-12-10)
@@ -17,10 +17,10 @@ import com.facebook.presto.operator.AggregationOperator.AggregationOperatorFacto
 import com.facebook.presto.operator.OperatorFactory;
 import com.facebook.presto.sql.planner.plan.AggregationNode.Step;
 import com.facebook.presto.testing.LocalQueryRunner;
-import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableList;
 
 import java.util.List;
+import java.util.Optional;
 
 import static com.facebook.presto.benchmark.BenchmarkQueryRunner.createLocalQueryRunner;
 import static com.facebook.presto.operator.aggregation.CountAggregation.COUNT;
@@ -37,7 +37,7 @@ public class CountAggregationBenchmark
     protected List<? extends OperatorFactory> createOperatorFactories()
     {
         OperatorFactory tableScanOperator = createTableScanOperator(0, "orders", "orderkey");
-        AggregationOperatorFactory aggregationOperator = new AggregationOperatorFactory(1, Step.SINGLE, ImmutableList.of(COUNT.bind(ImmutableList.of(0), Optional.<Integer>absent(), Optional.<Integer>absent(), 1.0)));
+        AggregationOperatorFactory aggregationOperator = new AggregationOperatorFactory(1, Step.SINGLE, ImmutableList.of(COUNT.bind(ImmutableList.of(0), Optional.empty(), Optional.empty(), 1.0)));
         return ImmutableList.of(tableScanOperator, aggregationOperator);
     }
 
Project facebook/presto in file ...resto.benchmark.DoubleSumAggregationBenchmark.java (2014-12-10)
@@ -17,10 +17,10 @@ import com.facebook.presto.operator.AggregationOperator.AggregationOperatorFacto
 import com.facebook.presto.operator.OperatorFactory;
 import com.facebook.presto.sql.planner.plan.AggregationNode.Step;
 import com.facebook.presto.testing.LocalQueryRunner;
-import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableList;
 
 import java.util.List;
+import java.util.Optional;
 
 import static com.facebook.presto.benchmark.BenchmarkQueryRunner.createLocalQueryRunner;
 import static com.facebook.presto.operator.aggregation.DoubleSumAggregation.DOUBLE_SUM;
@@ -37,7 +37,7 @@ public class DoubleSumAggregationBenchmark
     protected List<? extends OperatorFactory> createOperatorFactories()
     {
         OperatorFactory tableScanOperator = createTableScanOperator(0, "orders", "totalprice");
-        AggregationOperatorFactory aggregationOperator = new AggregationOperatorFactory(1, Step.SINGLE, ImmutableList.of(DOUBLE_SUM.bind(ImmutableList.of(0), Optional.<Integer>absent(), Optional.<Integer>absent(), 1.0)));
+        AggregationOperatorFactory aggregationOperator = new AggregationOperatorFactory(1, Step.SINGLE, ImmutableList.of(DOUBLE_SUM.bind(ImmutableList.of(0), Optional.empty(), Optional.empty(), 1.0)));
         return ImmutableList.of(tableScanOperator, aggregationOperator);
     }