This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.function.Function; | |
import java.util.stream.Collectors; | |
import static java.lang.System.out; | |
import static java.util.stream.Collectors.summingInt; | |
public class Main { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@startmindmap kata-mindmap | |
* Ressources pour pratiquer les Katas | |
** Catalogues de Katas | |
*** Kata-Log : https://kata-log.rocks/ | |
*** CodingDojo : https://codingdojo.org/ | |
**** https://codingdojo.org/kata/ | |
*** Code Kata : http://codekata.com/ | |
** Katas spécialisés | |
*** Refactoring Katas | |
**** Tennis : https://github.com/emilybache/Tennis-Refactoring-Kata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
print('liste de nombres :', numbers) | |
numbers.reverse() | |
print('liste de nombres après reverse() :', numbers) | |
print('\n##############\n') | |
numbers = list(range(10)) | |
print('liste de nombres :', numbers) | |
reversed(numbers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A record to represent some characteristics of a noble House of Westeros | |
* */ | |
public record House(String name, String seat, String sigil, String familyWords) { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//A exécuter sous JShell : /open RecordExampleScript_1.java | |
public record House(String name, String seat, String sigil, String familyWords) { | |
} | |
var house = new House("Stark", "Winterfell", "A Gray Direwolf", "Winter is coming"); | |
System.out.println(house); // Utilisation implicte de la méthode toString | |
System.out.println(house.seat()); // Utilisation d'un accesseur |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//A exécuter sous JShell : /open RecordExampleScript_2.java | |
public record House(String name, String seat, String sigil, String familyWords) { | |
} | |
House house1 = new House("Stark", "Winterfell", "A Gray Direwolf", "Winter is coming"); | |
House house2 = new House("Stark", "Winterfell", "A Gray Direwolf", "Winter is coming"); | |
house1 == house2; // false - 2 références distinctes | |
house1.equals(house2); // true - comparaison basée sur le contenu | |
house1.hashCode() == house2.hashCode(); // true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public record Pair<U,V>(U first, V second) { | |
public static <U,V>Pair<U,V> of(U first, V second) { | |
return new Pair<>(first,second); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//A utiliser sous JShell : /open HouseStarkExample.java | |
var houseStark = """ | |
{ | |
"name": "Stark", | |
"main_seat": "Winterfell", | |
"ancestral_seat": "Winterfell", | |
"sigil": "A Gray Direwolf", | |
"family_words": "Winter is coming" | |
}"""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//A utiliser sous JShell : /open TextBlockEndMarkerExample.java | |
var houseStark_1 = """ | |
{ | |
"name": "Stark", | |
"main_seat": "Winterfell", | |
"ancestral_seat": "Winterfell", | |
"sigil": "A Gray Direwolf", | |
"family_words": "Winter is coming" | |
} | |
"""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//A utiliser sous JShell : /open HouseStarkExampleWithEndlineSpaces.java | |
var houseStark = """ | |
{ | |
"name": "Stark", | |
"main_seat": "Winterfell", | |
"ancestral_seat": "Winterfell", | |
"sigil": "A Gray Direwolf", | |
"family_words": "Winter is coming" | |
}"""; |
OlderNewer