ArrayStream (PsiForeachStatement statement) { PsiExpression iteratedValue = statement.getIteratedValue(); if (iteratedValue == null) return null; PsiArrayType iteratedValueType = tryCast(iteratedValue.getType(), PsiArrayType.class); PsiParameter parameter = statement.getIterationParameter(); if (iteratedValueType != null && StreamApiUtil.isSupportedStreamElement(iteratedValueType.getComponentType()) && (!(parameter.getType() instanceof PsiPrimitiveType) || parameter.getType().equals(iteratedValueType.getComponentType()))) { return new ArrayStream(statement, parameter, iteratedValue); } return null; }