Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Arrays;
- import java.util.Date;
- /**
- * <p> </p>
- *
- * @author: Савинов В.М.
- * created: 31.03.2020
- * @version: 0.0.1-SNAPSHOT
- */
- public class Main<T extends Comparable<T>> {
- public static void main(String[] args) {
- Main main = new Main();
- main.testDateBubbleSort();
- main.testStringBubbleSort();
- main.testIntegerBubbleSort();
- }
- private void testDateBubbleSort() {
- final long currentTimeMillis = System.currentTimeMillis();
- final Date now = new Date(currentTimeMillis);
- final Date after = new Date(currentTimeMillis + 111111);
- final Date before = new Date(currentTimeMillis - 111111);
- final Date[] dates = {now, after, before};
- testBubbleSort((T[]) dates);
- printLine();
- }
- private void testStringBubbleSort() {
- String[] strings = {"keeek", "alo", "mmm"};
- testBubbleSort((T[]) strings);
- printLine();
- }
- private void testIntegerBubbleSort() {
- Integer[] integers = {1, 6, 2, 7, 2};
- testBubbleSort((T[]) integers);
- printLine();
- }
- private void testBubbleSort(T[] testArray){
- Arrays.stream(
- new Sorts<T>().bubbleSort(testArray))
- .forEach(System.out::println);
- }
- private void printLine() {
- System.out.println("================================");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement