Commit c667a7ef authored by Stephane Nicoll's avatar Stephane Nicoll

Merge pull request #15575 from igor-suhorukov

* pr/15575:
  Polish "Use Optional value in more functional style"
  Use Optional value in more functional style
parents 7946bec1 d57f831f
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -63,10 +63,9 @@ class CompositeHandlerAdapter implements HandlerAdapter { ...@@ -63,10 +63,9 @@ class CompositeHandlerAdapter implements HandlerAdapter {
@Override @Override
public long getLastModified(HttpServletRequest request, Object handler) { public long getLastModified(HttpServletRequest request, Object handler) {
Optional<HandlerAdapter> adapter = getAdapter(handler); Optional<HandlerAdapter> adapter = getAdapter(handler);
if (adapter.isPresent()) { return adapter
return adapter.get().getLastModified(request, handler); .map((handlerAdapter) -> handlerAdapter.getLastModified(request, handler))
} .orElse(0L);
return 0;
} }
private Optional<HandlerAdapter> getAdapter(Object handler) { private Optional<HandlerAdapter> getAdapter(Object handler) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment