equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package javax.sound.sampled.spi; |
26 package javax.sound.sampled.spi; |
27 |
27 |
28 import java.util.Objects; |
28 import java.util.Arrays; |
29 |
29 |
30 import javax.sound.sampled.Mixer; |
30 import javax.sound.sampled.Mixer; |
31 |
31 |
32 /** |
32 /** |
33 * A provider or factory for a particular mixer type. This mechanism allows the |
33 * A provider or factory for a particular mixer type. This mechanism allows the |
52 * @return {@code true} if the specified mixer is supported, otherwise |
52 * @return {@code true} if the specified mixer is supported, otherwise |
53 * {@code false} |
53 * {@code false} |
54 * @throws NullPointerException if {@code info} is {@code null} |
54 * @throws NullPointerException if {@code info} is {@code null} |
55 * @see #getMixerInfo() |
55 * @see #getMixerInfo() |
56 */ |
56 */ |
57 public boolean isMixerSupported(Mixer.Info info) { |
57 public boolean isMixerSupported(final Mixer.Info info) { |
58 Objects.requireNonNull(info); |
58 return Arrays.stream(getMixerInfo()).anyMatch(info::equals); |
59 |
|
60 Mixer.Info infos[] = getMixerInfo(); |
|
61 |
|
62 for(int i=0; i<infos.length; i++){ |
|
63 if( info.equals( infos[i] ) ) { |
|
64 return true; |
|
65 } |
|
66 } |
|
67 return false; |
|
68 } |
59 } |
69 |
60 |
70 /** |
61 /** |
71 * Obtains the set of info objects representing the mixer or mixers provided |
62 * Obtains the set of info objects representing the mixer or mixers provided |
72 * by this MixerProvider. |
63 * by this MixerProvider. |