Demo:
package org.springframework.data.redis.cache; @FunctionalInterface public interface CacheKeyPrefix { String compute(String var1); static CacheKeyPrefix simple() { return (name) -> { return name + "::"; }; } }
Interface to the inside of the default implementation of the method, there can be multiple implementations. Advantage is, do not achieve a lot of class, but also to achieve the characteristic java polymorphism.