import java.util.List;

class Ideone {
	public static void main (String[] args) {
		List students = List.of(
				Student.of(1.0),
				"foo",
				Student.of(2.0),
				new Object(),
				Student.of(3.0),
				Student.of(4.0));
		
		System.out.println(sumScore(students));
	}
	
	public static double sumScore(List students) {
		return ((List<?>) students).stream()
			.filter(o -> o instanceof Student)
			.map(o -> (Student) o)
			.mapToDouble(Student::getScore)
			.sum();
	}
}

class Student {
	final double score;
	
	private Student(double score) {
		this.score = score;
	}
	
	public static Student of(double score) {
		return new Student(score);
	}
	
	public double getScore() {
		return score;
	}
}