Skip to content

Commit

Permalink
KNOX-937 - Remove redundant type information from Collections (Colm O…
Browse files Browse the repository at this point in the history
… hEigeartaigh via Sandeep More)
  • Loading branch information
moresandeep committed May 19, 2017
1 parent efc361d commit 5515056
Show file tree
Hide file tree
Showing 103 changed files with 184 additions and 184 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public class BaseDirectoryService implements DirectoryService
private Partition systemPartition;

/** The set of all declared partitions */
private Set<Partition> partitions = new HashSet<Partition>();
private Set<Partition> partitions = new HashSet<>();

/** A list of LDIF entries to inject at startup */
private List<? extends LdifEntry> testEntries = new ArrayList<LdifEntry>(); // List<Attributes>
Expand Down Expand Up @@ -330,7 +330,7 @@ public String getInstanceId()
*/
public Set<? extends Partition> getPartitions()
{
Set<Partition> cloned = new HashSet<Partition>();
Set<Partition> cloned = new HashSet<>();
cloned.addAll( partitions );
return cloned;
}
Expand All @@ -343,9 +343,9 @@ public Set<? extends Partition> getPartitions()
*/
public void setPartitions( Set<? extends Partition> partitions )
{
Set<Partition> cloned = new HashSet<Partition>();
Set<Partition> cloned = new HashSet<>();
cloned.addAll( partitions );
Set<String> names = new HashSet<String>();
Set<String> names = new HashSet<>();

for ( Partition partition : cloned )
{
Expand Down Expand Up @@ -649,7 +649,7 @@ private void removeOperationsList( String interceptorName )
*/
public void setInterceptors( List<Interceptor> interceptors )
{
Map<String, Interceptor> interceptorNames = new HashMap<String, Interceptor>();
Map<String, Interceptor> interceptorNames = new HashMap<>();

// Check if we don't have duplicate names in the interceptors list
for ( Interceptor interceptor : interceptors )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static HaServiceConfig createServiceConfig(String serviceName, String ena
}

private static Map<String, String> parseHaConfiguration(String configuration) {
Map<String, String> parameters = new HashMap<String, String>();
Map<String, String> parameters = new HashMap<>();
if (configuration != null) {
String[] pairs = configuration.split(CONFIG_PAIRS_DELIMITER);
for (String pair : pairs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public Map getParameterMap() {
public Enumeration getParameterNames() {
Map<String, String[]> params = getParams();
if (params == null) {
params = new HashMap<String, String[]>();
params = new HashMap<>();
}
Enumeration<String> e = Collections.enumeration((Collection<String>) params.keySet());

Expand All @@ -93,7 +93,7 @@ public Enumeration getParameterNames() {
public String[] getParameterValues(String name) {
Map<String, String[]> params = getParams();
if (params == null) {
params = new HashMap<String, String[]>();
params = new HashMap<>();
}

return params.get(name);
Expand All @@ -106,7 +106,7 @@ private Map<String, String[]> getParams( String qString ) {
params = HttpUtils.parseQueryString( qString );
}
else {
params = new HashMap<String, String[]>();
params = new HashMap<>();
}
}
else {
Expand All @@ -130,7 +130,7 @@ public String getQueryString() {
Map<String, String[]> params = getParams();

if (params == null) {
params = new HashMap<String, String[]>();
params = new HashMap<>();
}

ArrayList<String> al = new ArrayList<String>();
Expand Down Expand Up @@ -167,7 +167,7 @@ private List<String> getImpersonationParamNames() {

private Map<String, String[]> scrubOfExistingPrincipalParams(
Map<String, String[]> params, List<String> principalParamNames) {
HashSet<String> remove = new HashSet<String>();
HashSet<String> remove = new HashSet<>();
for (String paramKey : params.keySet()) {
for (String p : principalParamNames) {
if (p.equalsIgnoreCase(paramKey)) {
Expand Down Expand Up @@ -204,7 +204,7 @@ public ServletInputStream getInputStream() throws java.io.IOException {
String body = IOUtils.toString( super.getInputStream(), encoding );
Map<String, String[]> params = getParams( body );
if (params == null) {
params = new HashMap<String, String[]>();
params = new HashMap<>();
}
body = urlEncode( params, encoding );
// ASCII is OK here because the urlEncode about should have already escaped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,22 +247,22 @@ public void testUrlEncode() {
String s;
HashMap<String,String[]> m;

m = new HashMap<String,String[]>();
m = new HashMap<>();
m.put( "null-values", null );
s = IdentityAsserterHttpServletRequestWrapper.urlEncode( m, "UTF-8" );
assertThat( s, is( "null-values" ) );

m = new HashMap<String,String[]>();
m = new HashMap<>();
m.put( "no-values", new String[0] );
s = IdentityAsserterHttpServletRequestWrapper.urlEncode( m, "UTF-8" );
assertThat( s, is( "no-values" ) );

m = new HashMap<String,String[]>();
m = new HashMap<>();
m.put( "one-value", new String[]{ "value1" } );
s = IdentityAsserterHttpServletRequestWrapper.urlEncode( m, "UTF-8" );
assertThat( s, is( "one-value=value1" ) );

m = new HashMap<String,String[]>();
m = new HashMap<>();
m.put( "two-values", new String[]{ "value1", "value2" } );
s = IdentityAsserterHttpServletRequestWrapper.urlEncode( m, "UTF-8" );
assertThat( s, is( "two-values=value1&two-values=value2" ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public void testServiceLoader() throws Exception {

@Test
public void testRequestUrlRewriteOfUsernameViaRewriteRule() throws Exception {
Map<String,String> initParams = new HashMap<String,String>();
Map<String,String> initParams = new HashMap<>();
initParams.put( "request.url", "test-rule-username" );
setUp( "test-user", initParams );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void testDeployment() throws IOException {

UrlRewriteRulesDescriptorImpl rewriteRules = new UrlRewriteRulesDescriptorImpl();

Map<String,String> providerParams = new HashMap<String, String>();
Map<String,String> providerParams = new HashMap<>();
providerParams.put( "test-host-external", "test-host-internal" );
Provider provider = new Provider();
provider.setEnabled( true );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void setUp( String username, Map<String,String> initParams ) throws Excep

@Test
public void testServiceRegistryFunctionsOnXmlRequestBody() throws Exception {
Map<String,String> initParams = new HashMap<String,String>();
Map<String,String> initParams = new HashMap<>();
initParams.put( "request.body", "oozie-conf" );
setUp( "test-user", initParams );

Expand Down Expand Up @@ -147,7 +147,7 @@ public void testServiceRegistryFunctionsOnXmlRequestBody() throws Exception {

@Test
public void testServiceRegistryFunctionsOnJsonRequestBody() throws Exception {
Map<String,String> initParams = new HashMap<String,String>();
Map<String,String> initParams = new HashMap<>();
initParams.put( "request.body", "oozie-conf" );
setUp( "test-user", initParams );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.apache.hadoop.gateway.util.urltemplate.Params;

public class EncryptStepContextParams implements Params {
Map<String, List<String>> params = new HashMap<String, List<String>>();
Map<String, List<String>> params = new HashMap<>();

public EncryptStepContextParams() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void testDeployment() throws IOException {

// UrlRewriteRulesDescriptorImpl rewriteRules = new UrlRewriteRulesDescriptorImpl();

Map<String,String> providerParams = new HashMap<String, String>();
Map<String,String> providerParams = new HashMap<>();
// providerParams.put( "test-host-external", "test-host-internal" );
Provider provider = new Provider();
provider.setEnabled( true );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static <T extends UrlRewriteFunctionDescriptor<?>> T create( String name

private static Map<String,Class<? extends UrlRewriteFunctionDescriptor>> loadDescriptors() {
Map<String,Class<? extends UrlRewriteFunctionDescriptor>> map
= new HashMap<String, Class<? extends UrlRewriteFunctionDescriptor>>();
= new HashMap<>();
ServiceLoader<? extends UrlRewriteFunctionDescriptor> descriptors
= ServiceLoader.load( UrlRewriteFunctionDescriptor.class );
for( UrlRewriteFunctionDescriptor descriptor : descriptors ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ public class UrlRewriteProcessor implements UrlRewriter {

UrlRewriteEnvironment environment;
UrlRewriteRulesDescriptor descriptor;
Map<String,UrlRewriteRuleProcessorHolder> rules = new HashMap<String,UrlRewriteRuleProcessorHolder>();
Map<String,UrlRewriteRuleProcessorHolder> rules = new HashMap<>();
ScopedMatcher inbound = new ScopedMatcher();
ScopedMatcher outbound = new ScopedMatcher();
Map<String,UrlRewriteFunctionProcessor> functions = new HashMap<String,UrlRewriteFunctionProcessor>();
Map<String,UrlRewriteFunctionProcessor> functions = new HashMap<>();

public UrlRewriteProcessor() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static <T extends UrlRewriteStepDescriptor<?>> T create( String type ) {

private static Map<String,Class<? extends UrlRewriteStepDescriptor>> loadStepDescriptors() {
Map<String,Class<? extends UrlRewriteStepDescriptor>> map
= new HashMap<String, Class<? extends UrlRewriteStepDescriptor>>();
= new HashMap<>();
ServiceLoader<? extends UrlRewriteStepDescriptor> descriptors
= ServiceLoader.load( UrlRewriteStepDescriptor.class );
for( UrlRewriteStepDescriptor descriptor : descriptors ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static InputStream create(
}

private static Map<String,Map<String,UrlRewriteStreamFilter>> loadFactories() {
Map<String,Map<String,UrlRewriteStreamFilter>> typeMap = new HashMap<String,Map<String,UrlRewriteStreamFilter>>();
Map<String,Map<String,UrlRewriteStreamFilter>> typeMap = new HashMap<>();
ServiceLoader<UrlRewriteStreamFilter> filters = ServiceLoader.load( UrlRewriteStreamFilter.class );
for( UrlRewriteStreamFilter filter : filters ) {
String[] types = filter.getTypes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void initialize( UrlRewriteEnvironment environment, FrontendFunctionDescr
throw new IllegalArgumentException( "environment==null" );
}
URI frontend = environment.getAttribute( FrontendFunctionDescriptor.FRONTEND_URI_ATTRIBUTE );
resolvers = new HashMap<String,UrlRewriteResolver>();
resolvers = new HashMap<>();
if( frontend == null ) {
resolvers.put( "url", new ParamResolver( "gateway.url" ) );
resolvers.put( "addr", new ParamResolver( "gateway.addr" ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public Evaluator getEvaluator() {

private class ContextParameters implements Params {

Map<String,List<String>> map = new HashMap<String,List<String>>();
Map<String,List<String>> map = new HashMap<>();

@Override
public Set<String> getNames() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ public static UrlRewriteFunctionProcessor create( String name, UrlRewriteFunctio

private static Map<Class<? extends UrlRewriteFunctionDescriptor>,Map<String,Class<? extends UrlRewriteFunctionProcessor>>> loadProcessors() {
Map<Class<? extends UrlRewriteFunctionDescriptor>,Map<String,Class<? extends UrlRewriteFunctionProcessor>>> descriptorMap
= new HashMap<Class<? extends UrlRewriteFunctionDescriptor>,Map<String,Class<? extends UrlRewriteFunctionProcessor>>>();
= new HashMap<>();
ServiceLoader<UrlRewriteFunctionProcessor> processors = ServiceLoader.load( UrlRewriteFunctionProcessor.class );
for( UrlRewriteFunctionProcessor processor : processors ) {
Class<? extends UrlRewriteFunctionDescriptor> descriptorInterface = getDescriptorInterface( processor );
Map<String,Class<? extends UrlRewriteFunctionProcessor>> typeMap = descriptorMap.get( descriptorInterface );
if( typeMap == null ) {
typeMap = new HashMap<String,Class<? extends UrlRewriteFunctionProcessor>>();
typeMap = new HashMap<>();
descriptorMap.put( descriptorInterface, typeMap );
}
String functionName = processor.name();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class UrlRewriteResponse extends GatewayResponseWrapper implements Params
// Testing with 16K made no appreciable difference.
private static final int STREAM_BUFFER_SIZE = 8 * 1024;

private static final Set<String> IGNORE_HEADER_NAMES = new HashSet<String>();
private static final Set<String> IGNORE_HEADER_NAMES = new HashSet<>();
static {
IGNORE_HEADER_NAMES.add( "Content-Length" );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private static UrlRewriter.Direction parseDirection( String direction ) {
return directionNameMap.get( direction );
}

private static Map<String,UrlRewriter.Direction> directionNameMap = new HashMap<String,UrlRewriter.Direction>();
private static Map<String,UrlRewriter.Direction> directionNameMap = new HashMap<>();
static {
directionNameMap.put( "inbound", UrlRewriter.Direction.IN );
directionNameMap.put( "in", UrlRewriter.Direction.IN );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@

public class UrlRewriteRulesDescriptorImpl implements UrlRewriteRulesDescriptor {

private Map<String,UrlRewriteFunctionDescriptor> funcMap = new HashMap<String,UrlRewriteFunctionDescriptor>();
private Map<String,UrlRewriteFunctionDescriptor> funcMap = new HashMap<>();
private List<UrlRewriteFunctionDescriptor> funcList = new ArrayList<UrlRewriteFunctionDescriptor>();
private List<UrlRewriteRuleDescriptor> ruleList = new ArrayList<UrlRewriteRuleDescriptor>();
private Map<String,UrlRewriteRuleDescriptor> ruleMap = new HashMap<String,UrlRewriteRuleDescriptor>();
private Map<String,UrlRewriteRuleDescriptor> ruleMap = new HashMap<>();
private List<UrlRewriteFilterDescriptor> filterList = new ArrayList<UrlRewriteFilterDescriptor>();
private Map<String,UrlRewriteFilterDescriptor> filterMap = new HashMap<String,UrlRewriteFilterDescriptor>();
private Map<String,UrlRewriteFilterDescriptor> filterMap = new HashMap<>();

@Override
public void addRules( UrlRewriteRulesDescriptor rules ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ public static UrlRewriteStepProcessor create( UrlRewriteStepDescriptor descripto

private static Map<Class<? extends UrlRewriteStepDescriptor>,Map<String,Class<? extends UrlRewriteStepProcessor>>> loadStepProcessors() {
Map<Class<? extends UrlRewriteStepDescriptor>,Map<String,Class<? extends UrlRewriteStepProcessor>>> descriptorMap
= new HashMap<Class<? extends UrlRewriteStepDescriptor>,Map<String,Class<? extends UrlRewriteStepProcessor>>>();
= new HashMap<>();
ServiceLoader<UrlRewriteStepProcessor> processors = ServiceLoader.load( UrlRewriteStepProcessor.class );
for( UrlRewriteStepProcessor processor : processors ) {
Class<? extends UrlRewriteStepDescriptor> descriptorInterface = getDescriptorInterface( processor );
Map<String,Class<? extends UrlRewriteStepProcessor>> typeMap = descriptorMap.get( descriptorInterface );
if( typeMap == null ) {
typeMap = new HashMap<String,Class<? extends UrlRewriteStepProcessor>>();
typeMap = new HashMap<>();
descriptorMap.put( descriptorInterface, typeMap );
}
String processorType = processor.getType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ private QName getQName( String name ) {

private Map<String,String> getNamespaces() {
if( namespaces == null ) {
namespaces = new HashMap<String,String>();
namespaces = new HashMap<>();
parseNamespaces();
}
return namespaces;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ public void testSolrRewriteDefaultPort() throws Exception {
* @return a map, with the key-values pairs representing the URL parameters.
*/
private Map<String, String> mapUrlParameters(String urlParameters) {
final Map<String, String> map = new HashMap<String, String>();
final Map<String, String> map = new HashMap<>();
for (String pair : urlParameters.split("&")) {
String[] kv = pair.split("=");
map.put(kv[0], kv[1]);
Expand Down
Loading

0 comments on commit 5515056

Please sign in to comment.