Warning: include_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /home/users/2/moriya-h5/web/confrage/java/set/linkedhashset/linkedhashset.html on line 2

Warning: include_once(http://www.confrage.com/bin/header.php): failed to open stream: no suitable wrapper could be found in /home/users/2/moriya-h5/web/confrage/java/set/linkedhashset/linkedhashset.html on line 2

Warning: include_once(): Failed opening 'http://www.confrage.com/bin/header.php' for inclusion (include_path='.:/usr/local/php/5.6/lib/php') in /home/users/2/moriya-h5/web/confrage/java/set/linkedhashset/linkedhashset.html on line 2
LinkedHashSet | Java | 株式会社CONFRAGE
Warning: include_once(/home/sites/heteml/users/m/o/r/moriya-h5/web/confrage/bin/menu.php): failed to open stream: No such file or directory in /home/users/2/moriya-h5/web/confrage/java/set/linkedhashset/linkedhashset.html on line 17

Warning: include_once(): Failed opening '/home/sites/heteml/users/m/o/r/moriya-h5/web/confrage/bin/menu.php' for inclusion (include_path='.:/usr/local/php/5.6/lib/php') in /home/users/2/moriya-h5/web/confrage/java/set/linkedhashset/linkedhashset.html on line 17
LinkedHashSet
LinkedHashSetはSetインターフェースを実装したクラスで、値の挿入順を保持します。
要素を取得する順序は挿入順です。また、重複する要素の追加は許されません。

以下、サンプルです。

import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;

public class ExIterator {
    public static void main(String[] args) {

        Set set = new LinkedHashSet();
        set.add("2");
        set.add("1");
        set.add("1");
        set.add("3");
        set.add("1");
        set.add("4");
        
        Iterator itr = set.iterator(); 
        while (itr.hasNext()) {
            String element = (String)itr.next();
            System.out.println(element);
        }  
    }
}
実行結果は以下のようになります。

2
1
3
4

Back to top

Information

Warning: include_once(/home/sites/heteml/users/m/o/r/moriya-h5/web/confrage/bin/side_bar.php): failed to open stream: No such file or directory in /home/users/2/moriya-h5/web/confrage/java/set/linkedhashset/linkedhashset.html on line 88

Warning: include_once(): Failed opening '/home/sites/heteml/users/m/o/r/moriya-h5/web/confrage/bin/side_bar.php' for inclusion (include_path='.:/usr/local/php/5.6/lib/php') in /home/users/2/moriya-h5/web/confrage/java/set/linkedhashset/linkedhashset.html on line 88

Warning: include_once(/home/sites/heteml/users/m/o/r/moriya-h5/web/confrage/bin/seo.php): failed to open stream: No such file or directory in /home/users/2/moriya-h5/web/confrage/java/set/linkedhashset/linkedhashset.html on line 97

Warning: include_once(): Failed opening '/home/sites/heteml/users/m/o/r/moriya-h5/web/confrage/bin/seo.php' for inclusion (include_path='.:/usr/local/php/5.6/lib/php') in /home/users/2/moriya-h5/web/confrage/java/set/linkedhashset/linkedhashset.html on line 97