Hey guys! This might be an anti-pattern in Kotlin...
# getting-started
m
Hey guys! This might be an anti-pattern in Kotlin. I want to assure that a variable is initialized only in the constructor and its value will become immutable. I would do something like that like so:
Copy code
public class Metrics {
  private final StatsDClient statsd;
  ...
  public Metrics(String host, int port) {
    statsd = new MarceloStatsDClient(host, port);
  }
  public void count(String aspect, Long delta, String... tags) {
    statsd.count(aspect, delta, tags);
  }
  ....
}
How would I do that in Kotlin?