<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="et">
	<id>http://courses.cs.taltech.ee/w/index.php?action=history&amp;feed=atom&amp;title=ITI0011%3Apraktikum_17_G34</id>
	<title>ITI0011:praktikum 17 G34 - Redigeerimiste ajalugu</title>
	<link rel="self" type="application/atom+xml" href="http://courses.cs.taltech.ee/w/index.php?action=history&amp;feed=atom&amp;title=ITI0011%3Apraktikum_17_G34"/>
	<link rel="alternate" type="text/html" href="http://courses.cs.taltech.ee/w/index.php?title=ITI0011:praktikum_17_G34&amp;action=history"/>
	<updated>2026-05-21T19:05:44Z</updated>
	<subtitle>Selle lehekülje redigeerimiste ajalugu</subtitle>
	<generator>MediaWiki 1.35.9</generator>
	<entry>
		<id>http://courses.cs.taltech.ee/w/index.php?title=ITI0011:praktikum_17_G34&amp;diff=2275&amp;oldid=prev</id>
		<title>Ago: Uus lehekülg: &#039;&lt;source lang=&quot;java&quot;&gt;  import java.util.ArrayList; import java.util.Arrays; import java.util.Collections;  public class SortExample {  	public static class Animal implements Compa...&#039;</title>
		<link rel="alternate" type="text/html" href="http://courses.cs.taltech.ee/w/index.php?title=ITI0011:praktikum_17_G34&amp;diff=2275&amp;oldid=prev"/>
		<updated>2015-03-31T13:52:25Z</updated>

		<summary type="html">&lt;p&gt;Uus lehekülg: &amp;#039;&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;  import java.util.ArrayList; import java.util.Arrays; import java.util.Collections;  public class SortExample {  	public static class Animal implements Compa...&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Uus lehekülg&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
import java.util.ArrayList;&lt;br /&gt;
import java.util.Arrays;&lt;br /&gt;
import java.util.Collections;&lt;br /&gt;
&lt;br /&gt;
public class SortExample {&lt;br /&gt;
&lt;br /&gt;
	public static class Animal implements Comparable&amp;lt;Animal&amp;gt; {&lt;br /&gt;
		public String name;&lt;br /&gt;
		public int weight;&lt;br /&gt;
		public int age;&lt;br /&gt;
		&lt;br /&gt;
		public Animal(int weight, int age) {&lt;br /&gt;
			this.weight = weight;&lt;br /&gt;
			this.age = age;&lt;br /&gt;
		}&lt;br /&gt;
		@Override&lt;br /&gt;
		public String toString() {&lt;br /&gt;
			return &amp;quot;age: &amp;quot; + age + &amp;quot; weight: &amp;quot; + weight;&lt;br /&gt;
		}&lt;br /&gt;
		@Override&lt;br /&gt;
		public int compareTo(Animal o) {&lt;br /&gt;
			if (this.age &amp;lt; o.age) {&lt;br /&gt;
				return -1;&lt;br /&gt;
			} else if (this.age &amp;gt; o.age) {&lt;br /&gt;
				return 68;&lt;br /&gt;
			} else {&lt;br /&gt;
				// age == age&lt;br /&gt;
				if (this.weight &amp;lt; o.weight) {&lt;br /&gt;
					return -113;&lt;br /&gt;
				} else if (this.weight &amp;gt; o.weight) {&lt;br /&gt;
					return 230948234;&lt;br /&gt;
				} &lt;br /&gt;
			}&lt;br /&gt;
			// age == age &amp;amp;&amp;amp; weight == weight&lt;br /&gt;
			return 0;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static void main(String[] args) {&lt;br /&gt;
		String[] strings = new String[]{&amp;quot;tere&amp;quot;, &amp;quot;auto&amp;quot;, &amp;quot;luud&amp;quot;};&lt;br /&gt;
		Arrays.sort(strings);&lt;br /&gt;
	&lt;br /&gt;
		System.out.println(Arrays.toString(strings));&lt;br /&gt;
		&lt;br /&gt;
		ArrayList&amp;lt;Animal&amp;gt; animals = new ArrayList&amp;lt;Animal&amp;gt;();&lt;br /&gt;
		Animal a1 = new Animal(10, 10);&lt;br /&gt;
		Animal a2 = new Animal(12, 10);&lt;br /&gt;
		Animal a3 = new Animal(12, 9);&lt;br /&gt;
		System.out.println(a1);&lt;br /&gt;
		animals.add(a2);&lt;br /&gt;
		animals.add(a1);&lt;br /&gt;
		animals.add(a3);&lt;br /&gt;
		// sort?&lt;br /&gt;
		Collections.sort(animals);&lt;br /&gt;
		&lt;br /&gt;
		System.out.println(Arrays.toString(animals.toArray()));&lt;br /&gt;
		&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ago</name></author>
	</entry>
</feed>