Login   Register  
PHP Classes
elePHPant
Icontem

File: demo/treesetdemo.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Ordland  >  PHP Collections Framework  >  demo/treesetdemo.php  >  Download  
File: demo/treesetdemo.php
Role: Example script
Content type: text/plain
Description: A demo using TreeSet
Class: PHP Collections Framework
Manipulate collections of objects like Java and C#
Author: By
Last change:
Date: 2013-04-08 04:53
Size: 795 bytes
 

Contents

Class file image Download
<?php

require "autoloader.php";
use 
Resource\Native\String as String;
use 
Resource\Collection\TreeSet as TreeSet;

$mithos = new String("Mithos Yggdrasill");
$martel = new String("Martel Yggdrasill");
$yuan = new String("Yuan Ka-fei");
$kratos = new String("Kratos Aurion");
$remiel = new String("Remiel");

$pronyma = new String("Pronyma");
$forcystus = new String("Forcystus");
$rodyle = new String("Rodyle");
$kvar = new String("Kvar");
$magnius = new String("Magnius");

$set = new TreeSet;
$set->add($mithos);
$set->add($martel);
$set->add($yuan);
$set->add($kratos);
$set->add($remiel);

$iterator $set->iterator();
while(
$set->size() > 0){
    echo 
"{$set->pollFirst()}<br>";
    echo 
"Current Set Size is: {$set->size()}<br>";
}

//var_dump($set);

?>