Kotlin is a statically typed programming language that compiles to JVM byte codes and JavaScript.

learn more… | top users | synonyms

0
votes
1answer
61 views

Redis protocol implementation by Kotlin

I have created my first project on the github. It is Redis client protocol implementation (request-responce part only). I would like to make my sources more Kotlin style. Please, check my sources and ...
0
votes
1answer
34 views

Kotlin Data Class Wildcard

I'm writing a small custom DSL and interpreter as an exercise in understanding how the language stack (lexer/parser/(interpreter/compiler)) works. Because I want to be able to report the location of ...
1
vote
1answer
57 views

LeetCode: Add Two Numbers (in Kotlin)

(...as I still learning Kotlin) I found this "problem": You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain ...
3
votes
2answers
39 views

Return the indices of the two numbers such that they add up to a specific target

(...as I learn Kotlin) I want to get the indices of the two numbers such that they add up to a specific target from a given array of integers. Solution: ...
3
votes
1answer
53 views

Christmas Tree in Kotlin

Please review my code for printing a Christmas Tree. The idea was to merge some functional programming ideas (immutability, streams) and OOP (every thing is a small object). I'm looking for a review ...
7
votes
1answer
72 views

Reduce amount of calls to database for authentication

I'm currently having a bit of code, which I just know can be improved a lot. I am just blind to it. All of my code looks quite neat to me, except these parts... The login + authentication process is ...
2
votes
1answer
161 views

Event-driven finite state machine DSL in Kotlin

I wrote a DSL for defining a finite state machine. My robotics team wants to use a state machine to manage the state of the subsystems on our robot, like the arms, drive train, lifter, etc. Each ...
4
votes
2answers
45 views

Maximise adjacent numbers in a functional style (PE#11)

What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in the [provided] 20×20 grid? [source] This solution works, and works effectively ...
2
votes
0answers
208 views

Console command parser for my custom Libgdx console (gamedev)

For a game I'm writing using LibGDX framework and Kotlin language, I've decided to make a dev console. This is a WIP line parser. Since there's already a decent amount of code written I've decided to ...
4
votes
1answer
68 views

Credit card / IMEI check digit in Kotlin

I recently had the need to implement Luhn's Algorithm in a Java/Kotlin application. I needed a function that would add the check digit to the string of a number like a credit card or IMEI. It could be ...
2
votes
1answer
58 views

Postponed Prime Sequence in Kotlin

Following my previous unbounded prime generator and a followup by Martin R, I've tested the waters in Kotlin by making an unbounded sieve. To quote Martin R's wonderful explanation of the base ...
2
votes
0answers
49 views

Roman number converter in Kotlin

I'm learning kotlin and java. As a code-kata I wrote the roman to decimal converter. I'd be very grateful for code review. I was trying to keep things simple and funcional. I'd especially appreciate ...
0
votes
0answers
31 views

Check the battery's charge level and emit an alert on low/high value

The following script check constantly the battery's charge level of the user's laptop via the acpi command. When such level reach a low/high value, the script will ...
1
vote
1answer
206 views

Counter with increment and decrement buttons

For my first Kotlin project, I'm implementing the Redux pattern with simple Increment and Decrement buttons and a text view to display the current value. My main questions have to do with Kotlin and ...
1
vote
1answer
144 views

Iterate through a 2D array. Kotlin extension method

Simple extension method for Kotlin. Should perform an action on every element in a 2d array. i.e. An array of arrays. I have made the assumption that because the receiver type is defined as an array ...
2
votes
1answer
52 views

Interface to the Force.com REST API

I'm implementing an interface to the Force.com REST API, with very specific ideas about which parts of the API I need. My problem is with testability of consumers of this API abstraction. The first ...
4
votes
1answer
78 views

Number guessing game in Kotlin

Is this code missing any "Kotlinisms"? I've just started learning Kotlin so I'm not yet familiar with the Kotlin way of doing things. The program will guess a number you are thinking of. ...
3
votes
2answers
196 views

Cache of shared observables (Rx)

So the idea is to maintain a cache of shared Observables - accessible by a key - which if not present will produce one using the given factory. The underlying shared Observable is accessed via an ...
5
votes
3answers
97 views

Max heap implementation in Kotlin

I wrote this class a while ago to learn Kotlin and heaps, so any tips (on either my code style or my heap algorithm) would be appreciated! ...
4
votes
1answer
150 views

Stateless 2048 Game

I created a little Kotlin clone of the 2048 game that is playable in the console. My goals were readability and statelessness for no other reason than practice. Consider it a code kata wherein I didn'...
4
votes
1answer
693 views

Simple thread-safe loading cache based on RxJava

I'm sketching a simple thread-safe cache which can load missing values. It is based on RxJava's Observable which also means that it should be possible for a client to join a request for value which is ...
2
votes
0answers
186 views

Converting SpriteSheet Metadata .txt to .yaml

For practice I decided that I wanted to write an animation class for SpriteSheets. The problem is that a single Sprite can have different widths depending on the action they are drawn to act. A tool ...