Java tutorial
//package com.java2s; import java.awt.Frame; import java.util.ArrayList; import java.util.List; public class Main { /** * Finds frames with an icon: Frames of {@code Frame#getFrames()} where * {@code Frame#getIconImage()} returns not null. * * @return frames with an icon or an empty list */ public static List<Frame> findFramesWithIcons() { List<Frame> frames = new ArrayList<>(); Frame[] allFrames = Frame.getFrames(); for (Frame frame : allFrames) { if (frame.getIconImage() != null) { frames.add(frame); } } return frames; } }