- IMPORTANT: Things can break badly if you don't do things in the correct order. Make backups or if you're using version control, create branches that you can recover from.
- Do changes step-wise. That is, for all gradle files change single quotes, then do syntax changes, then do the plugins block.
- Sync Gradle often. Make each type of change for files then
This file contains hidden or 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
plugins { | |
id("com.android.application") | |
kotlin("android") | |
kotlin("android.extensions") | |
kotlin("kapt") | |
} | |
android { | |
compileSdkVersion(Versions.compileSdk) | |
defaultConfig { |
This file contains hidden or 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.io.File | |
import java.nio.charset.Charset | |
class SrtFile(private val file: File, private val defaultCharset: Charset = Charset.forName("UTF-8")) { | |
private val _subtitles by lazy { parse() } | |
val subtitles: List<Subtitle> get() = _subtitles | |
private fun parse(): MutableList<Subtitle> { | |
val list = mutableListOf<Subtitle>() |
This file contains hidden or 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
/** | |
* Description: A generic data type Deque. | |
* | |
* API Requirements: | |
* | |
* public class Deque<Item> implements Iterable<Item> { | |
* public Deque() // construct an empty deque | |
* public boolean isEmpty() // is the deque empty? | |
* public int size() // return the number of items on the deque | |
* public void addFirst(Item item) // add the item to the front |
This file contains hidden or 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 org.junit.jupiter.params.converter.*; | |
import java.lang.annotation.*; | |
/******************************************************************************* | |
* Name: Compare.java | |
* Date: 4/30/2019 | |
* Description: JUnit5 Parameterized Test Parameter Annotation | |
******************************************************************************/ | |
@Target({ ElementType.ANNOTATION_TYPE, ElementType.PARAMETER }) |
This file contains hidden or 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
/** | |
* Euclidean calculations on one-dimensional array indices | |
*/ | |
class Euclid { | |
/** | |
* Calculate the euclidean distance between two array indices | |
* | |
* @param current index | |
* @param goal index | |
* @return the distance from current to goal |
This file contains hidden or 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.lang.reflect.Method; | |
import java.lang.reflect.Modifier; | |
import java.util.ArrayList; | |
import java.util.List; | |
import static java.lang.System.out; | |
public class Spy { | |
public static List<Method> publicMethods(Class<?> clazz) { |
A simple Java challenge. This really stumped me the first time I ran across it. I made it work but looking at the code made absolutley no sense. Give it a try and let me know how you do.
Consider the following values:
8 1 3
4 0 2
7 6 5
- Store the values in a two-dimensional array of int.
- Move the 0 up by modifying a single index and swapping two values.
- This test suite is not exaustive.
- It requires removing the org.* restriction from auto import rules if you are using the IntelliJ project included in the course zip file. This is because the Junit5 development team used the based package org.junit.* instead of junit.* in many of the new libraries.
- It requires adding Junit5 dependencies.
This file contains hidden or 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
/** | |
* Name: Al Warren | |
* Date: 6/16/2019 | |
* Description: Test suite for an Immutable object type BaseballElimination. | |
* | |
* API Requirements: | |
* | |
* public BaseballElimination(String filename) // create a baseball division from given filename in format specified below | |
* public int numberOfTeams() // number of teams | |
* public Iterable<String> teams() // all teams |