<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Jacob Jerrell</title>
    <description>The latest articles on Forem by Jacob Jerrell (@machinehead).</description>
    <link>https://forem.com/machinehead</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3627898%2Facdca876-18d5-4735-8359-c1d1872c533b.jpeg</url>
      <title>Forem: Jacob Jerrell</title>
      <link>https://forem.com/machinehead</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/machinehead"/>
    <language>en</language>
    <item>
      <title>Why are you using QWERTY?</title>
      <dc:creator>Jacob Jerrell</dc:creator>
      <pubDate>Tue, 25 Nov 2025 13:36:51 +0000</pubDate>
      <link>https://forem.com/machinehead/why-are-you-using-qwerty-465j</link>
      <guid>https://forem.com/machinehead/why-are-you-using-qwerty-465j</guid>
      <description>&lt;p&gt;Putting all arguments of ergonomics aside, just take a look at the top row of your keyboard and notice how all of the letters for the word "TYPEWRITER" are up there. That's how dated your keyboard layout is. One part solution to a long gone problem and one part sales gimmick.&lt;br&gt;
 &lt;br&gt;
Somewhere around one-hundred years before the &lt;a href="https://en.wikipedia.org/wiki/Epoch_(computing)" rel="noopener noreferrer"&gt;Epoch Date&lt;/a&gt;, typists became quite efficient simply using two rows of keys from A-N and O-Z. So efficient, in fact, that they would commonly cause jams with frequently used pairs. In the 1870's, Remington entered the scene and began gradually developing the layout used by a majority of us today.&lt;/p&gt;

&lt;p&gt;Now, you can hardly shop for a desk without finding some mention of ergonomics. So we buy the desk -- a glorified piece of wood -- and place a keyboard with an archaic layout on it. QWERTY isn't for humans, it's a workaround for mechanical bars which are far removed from the mechanical keyboards of today.&lt;/p&gt;

&lt;p&gt;We're long overdue for reconsidering the dominant keyboard layout of today. We could easily forgive the first 60 years of the 1900's if we wanted to. But there really is no excuse. By 1893, the &lt;a href="https://en.wikipedia.org/wiki/Blickensderfer_typewriter" rel="noopener noreferrer"&gt;Blickensderfer typewriter&lt;/a&gt; was unveiled to the public with the keys "DHIATENSOR" positioned on the home-row. QWERTY was still an option, but consumers were made to sign a statement acknowledging that they were purchasing an inferior product.&lt;/p&gt;

&lt;p&gt;The most commonly known alternative to QWERTY, "Dvorak" was introduced as early as 1932 and patented by 1936. Still yet, nearly 100 years later, nothing has really put a dent in QWERTY's market dominance.&lt;/p&gt;

&lt;h1&gt;
  
  
  Alternatives
&lt;/h1&gt;

&lt;p&gt;Ranked by adoption numbers, &lt;a href="https://en.wikipedia.org/wiki/Dvorak_keyboard_layout" rel="noopener noreferrer"&gt;Dvorak&lt;/a&gt; still has the majority of the minority due. This popularity is largely owed to old-school.&lt;/p&gt;

&lt;p&gt;Next up would be the &lt;a href="https://en.wikipedia.org/wiki/Colemak" rel="noopener noreferrer"&gt;Colemak&lt;/a&gt; layout which was introduced in 2006 and is supported "out of the box" by almost every major operating system. Compared with QWERTY, 17 keys have changed locations. Cut/copy/paste (x/c/v) maintain the same positions, as do the comma and period keys. The colon is shifted up to the top row so that your home row is fully populated by alpha keys.&lt;/p&gt;

&lt;p&gt;Barely escaping the realm of niche layouts, we have &lt;a href="https://workmanlayout.org/" rel="noopener noreferrer"&gt;Workman&lt;/a&gt; being introduced in 2010. It's supported out of the box in Linux/X11 and is &lt;a href="https://github.com/workman-layout/Workman" rel="noopener noreferrer"&gt;easily installed on other common OS's&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Beyond those, you'll find hobbyist keyboard layouts such as: Norman, Asset, and Engram. Finally, you'll descend into absolute niche layouts such as the &lt;a href="https://en.wikipedia.org/wiki/Neo_(keyboard_layout)" rel="noopener noreferrer"&gt;Neo layout&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Transitioning
&lt;/h1&gt;

&lt;p&gt;This is the "gotcha". Your transition must be deliberate and practiced. Your typing speed will reduce temporarily and in all honesty, it won't be comfortable. The first time you're forced to use QWERTY again, it won't quite be like riding a bike--for a while, at least. &lt;/p&gt;

&lt;p&gt;You can't simply pluck the keys out of most laptops and rearrange them for visual reference. If you already primarily use a mechanical keyboard, your life will be simpler. If your mechanical keyboard can truly be programmed, even better.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Experience
&lt;/h2&gt;

&lt;p&gt;I began transitioning around 2018 while I was in a startup-themed "Skunkworks" organization. I was working long hours and typing A LOT on a laptop keyboard. I really began to question my T-Rex pose and attributed it directly to the constant pain I was feeling in my wrists and fingers. &lt;/p&gt;

&lt;p&gt;By this time, I had been using QWERTY for more than 20 years and thanks to an IT teacher's persistence, I had been using it "appropriately" for about 13 of those years. Frankly, I disagree with forcing students to "home" on QWERTY... "floating" is definitely going to lead to &lt;em&gt;less&lt;/em&gt; injury. I digress, I hold no resentment to the teacher who forced me to "home" because now I rarely leave it.&lt;/p&gt;

&lt;p&gt;It was hard to ignore the popularity of split keyboards, Microsoft and Logitech both had popular ones on the market. But I was acutely aware of the fact that, despite being trained, my left index finger still reaches for the "Y" key--present tense because I'm using my laptop with a QWERTY layout in the moments of typing this paragraph and notice that the left index even reaches for the "h" key about half of the time.&lt;/p&gt;

&lt;p&gt;Long story short(er), I can't solder. So I decided on the &lt;a href="https://ergodox-ez.com/" rel="noopener noreferrer"&gt;Ergodox EZ by ZSA&lt;/a&gt;; it's a split keyboard, columnar instead of staggered, and programmable. The last part was important because I had decided the Workman layout was for me and I didn't want to worry about whether the computer I was plugging into could support it or not; all of the logic is at the hardware layer. The QMK Firmware also offered to solve a handful (hah) of other problems: home-row modifiers, layering, macros, Hyper/Meh modifiers, and quite a lot more than I've even scraped the surface of.&lt;/p&gt;

&lt;h3&gt;
  
  
  Timelines
&lt;/h3&gt;

&lt;p&gt;While waiting for my order to arrive, I spent evenings using &lt;a href="https://thetypingcat.com/" rel="noopener noreferrer"&gt;The Typing Cat&lt;/a&gt;, which allows you to "emulate" alternative layouts. My fingers rebelled against me for a &lt;strong&gt;week or more&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Within &lt;strong&gt;a month&lt;/strong&gt;, I could barely use QWERTY and my typing speed with Workman was about 25-35 WPM--abysmal, in my opinion. I could do fine while coding, but I'd just about get up and walk across the office before trying to engage in a conversation over Teams or Slack.&lt;/p&gt;

&lt;p&gt;After the first month, I became quite comfortable with my choices. The new keyboard was fantastic, my thumbs were in charge of Enter, Tab, Space, Backspace, and layer changing. All modifiers were on the home row (mostly) and my left pinkie retained the traditional Shift-key location.&lt;/p&gt;

&lt;p&gt;For some period of time, texting was mildly uncomfortable. But to this day, I haven't found a suitable keyboard app on Android or iOS which is worth the trouble for having Workman available there.&lt;/p&gt;

&lt;p&gt;Within the second or third month, I had to visit a client site and my only option was to use their keyboards. It surely seemed like the expert they knew a year before must have had a seizure--It's not a laughing matter but I don't know how else to describe it.&lt;/p&gt;

&lt;p&gt;Finally, around three to four months, I just needed to look at the keyboard I was using, take a deep breath, and I could use either layout comfortably. By now, it's all muscle memory; QWERTY works just fine for recliner typing and nicely reminds me why I switched.&lt;/p&gt;

&lt;p&gt;At the end of the day, &lt;a href="https://github.com/jjerrell/qmk_userspace" rel="noopener noreferrer"&gt;my keyboard layouts&lt;/a&gt; resemble the layering theories shown in the Neo layout. But the home layer is Workman.&lt;/p&gt;

&lt;h2&gt;
  
  
  Your Experience
&lt;/h2&gt;

&lt;p&gt;Whether you turn this into a hobby as I have or simply reconfigure your OS to use an alternative layout, you absolutely should invest the time in yourself. I probably don't know you and it won't benefit me at all if you change layouts. But it will help you a lot.&lt;/p&gt;

&lt;p&gt;If pure statistics are your driving factor, I encourage you to explore the &lt;a href="https://workmanlayout.org/" rel="noopener noreferrer"&gt;website describing the Workman layout&lt;/a&gt;. It does a great job of highlighting the scores of the four main layouts I talked about here. &lt;/p&gt;

&lt;p&gt;I know of people who have learned multiple and can likely switch between at least three different layouts, but I recommend researching first, deciding on one, and sticking with it until you're good and comfortable with it.&lt;/p&gt;

&lt;p&gt;If you find yourself down the QMK rabbit hole, it used to be a lot easier to find inspiration. But due to the number of PRs and total size of the firmware repository, they've adopted a "user space" approach. Take a look a &lt;a href="https://github.com/drashna/qmk_userspace" rel="noopener noreferrer"&gt;Drashna's Userspace&lt;/a&gt; for a very advanced users setup. Follow the &lt;a href="https://docs.qmk.fm/newbs_external_userspace" rel="noopener noreferrer"&gt;firmware documentation&lt;/a&gt; if you want to start building your own&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Lambda's in Kotlin</title>
      <dc:creator>Jacob Jerrell</dc:creator>
      <pubDate>Mon, 24 Nov 2025 19:18:19 +0000</pubDate>
      <link>https://forem.com/machinehead/lambdas-in-kotlin-kl9</link>
      <guid>https://forem.com/machinehead/lambdas-in-kotlin-kl9</guid>
      <description>&lt;p&gt;Once you understand them, they seem so simple and you wonder how you ever had a problem with them. Early in my career, I definitely spent countless nights studying and trying to wrap my head around lambda's in Swift; terrified to tell anyone that I struggled to understand them.&lt;/p&gt;

&lt;p&gt;Years later, I've come to find that it's a very common place for even seasoned engineers to get stuck on, especially if their early experiences were with a non-functional language. I'm here to hopefully dispel some of the confusion surrounding them.&lt;/p&gt;

&lt;p&gt;In short, they're just functions that you can pass around. They can be used for configuration, dependency injection, and when using Jetpack Compose, they're highly recommended for use in State Hoisting.&lt;/p&gt;

&lt;h2&gt;
  
  
  For Java Engineers
&lt;/h2&gt;

&lt;p&gt;Perhaps most recognizable for Java engineers are callbacks implemented as SAM interfaces. A few recognizable examples standout as still being widely used within Kotlin today:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Runnable&lt;/code&gt;: &lt;code&gt;void run()&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Callable&amp;lt;V&amp;gt;&lt;/code&gt;: &lt;code&gt;V call()&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Comparator&amp;lt;T&amp;gt;&lt;/code&gt;: &lt;code&gt;int compare(T o1, T o2)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Consumer&amp;lt;T&amp;gt;&lt;/code&gt;: &lt;code&gt;void accept(T t)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Predicate&amp;lt;T&amp;gt;&lt;/code&gt;: &lt;code&gt;boolean test(T t)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Function&amp;lt;T, R&amp;gt;&lt;/code&gt;: &lt;code&gt;R apply(T t)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Supplier&amp;lt;T&amp;gt;&lt;/code&gt;: &lt;code&gt;T get()&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Simply put, they're interfaces annotated with &lt;code&gt;@FunctionalInterface&lt;/code&gt;. They have a single function and look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@FunctionalInterface&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;ConfigurableAction&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;View&lt;/span&gt; &lt;span class="n"&gt;view&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A custom &lt;code&gt;MaterialButton&lt;/code&gt; in Java using the interface would be written this way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ConfigurableButton&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;MaterialButton&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;ConfigurableAction&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;""&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;ConfigurableButton&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Context&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;ConfigurableButton&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Context&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;AttributeSet&lt;/span&gt; &lt;span class="n"&gt;attrs&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;attrs&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;ConfigurableButton&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Context&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;AttributeSet&lt;/span&gt; &lt;span class="n"&gt;attrs&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;defStyleAttr&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;super&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;attrs&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;defStyleAttr&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

        &lt;span class="n"&gt;setOnClickListener&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;OnClickListener&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="nd"&gt;@Override&lt;/span&gt;
            &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;View&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;action&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
                    &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;execute&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ConfigurableButton&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;this&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
                &lt;span class="o"&gt;}&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;});&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;configure&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;ConfigurableAction&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;action&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An early Java implementation would have you configuring the button as an anonymous class; using the &lt;code&gt;new ConfigurableAction()&lt;/code&gt; and override approach:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;button&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;configure&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"user_123"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ConfigurableAction&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nd"&gt;@Override&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;View&lt;/span&gt; &lt;span class="n"&gt;view&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;Toast&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;makeText&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Data: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Toast&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;LENGTH_SHORT&lt;/span&gt;&lt;span class="o"&gt;).&lt;/span&gt;&lt;span class="na"&gt;show&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you're using Java 8+, the IDE would likely suggest that you implement it as a lambda; which really just means you remove &lt;code&gt;new ConfigurableAction()&lt;/code&gt; , the function override, and bring the parameters from the execute function up to the where &lt;code&gt;new ConfigurableAction()&lt;/code&gt; was previously:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;button&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;configure&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"user_123"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;view&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Toast&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;makeText&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Data: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Toast&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;LENGTH_SHORT&lt;/span&gt;&lt;span class="o"&gt;).&lt;/span&gt;&lt;span class="na"&gt;show&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="o"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Kotlin, with the interface being the last parameter of the function, we can make it look a little nicer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="n"&gt;button&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;configure&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"user_123"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;view&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="p"&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class="nc"&gt;Toast&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;makeText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Data: $data"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Toast&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;LENGTH_SHORT&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;show&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The previous three snippets are equivalent. The second snippet is nearly perfectly valid Kotlin code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="n"&gt;button&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;configure&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"user_123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;view&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="p"&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class="nc"&gt;Toast&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;makeText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Data: "&lt;/span&gt; &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Toast&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;LENGTH_SHORT&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;show&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The third snippet is the result of taking the IDE's suggestion for moving the lambda argument of the most recent example out of the parenthesis.&lt;/p&gt;

&lt;h2&gt;
  
  
  For Jetpack Compose Engineers
&lt;/h2&gt;

&lt;p&gt;Life gets a whole lot easier in a lot of ways with Kotlin. Jetpack Compose is just the chef's kiss. The same interface and button from the Java example implemented in Kotlin and as a Composable is simply this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;KConfigurableAction&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nd"&gt;@Composable&lt;/span&gt;
&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;ConfigurableButton&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;modifier&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Modifier&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Modifier&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;KConfigurableAction&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;modifier&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;modifier&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;onClick&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Click me!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A view implementing the above button would do it this way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="nd"&gt;@Composable&lt;/span&gt;
&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;ButtonView&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;context&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;LocalContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;current&lt;/span&gt;
    &lt;span class="nc"&gt;ConfigurableButton&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Foo"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="p"&gt;-&amp;gt;&lt;/span&gt;
        &lt;span class="nc"&gt;Toast&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;makeText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Data: "&lt;/span&gt; &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Toast&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;LENGTH_SHORT&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;show&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But wait. We don't actually need the fun interface (Kotlin's way of dropping the need for an annotation for a common use case) at all and it's probably just going to be confusing and seem like a waste of keystrokes (it is) for the majority of engineers who've had the pleasure of working with Kotlin for a decent amount of time. So we would simply implement &lt;code&gt;ConfigurableButton&lt;/code&gt; with a lambda in the signature and never consider an interface for this scenario:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="nd"&gt;@Composable&lt;/span&gt;
&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;ConfigurableButton&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;modifier&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Modifier&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Modifier&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Unit&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;modifier&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;modifier&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;onClick&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nf"&gt;action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Click me!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the above implementation, &lt;code&gt;ButtonView&lt;/code&gt; doesn't change at all; it perfectly understands that it has a matching signature.&lt;br&gt;
Since the base &lt;code&gt;Button&lt;/code&gt;'s &lt;code&gt;onClick&lt;/code&gt; parameter in Compose doesn't expect an argument and you may not always need one, another sample button could be created like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="nd"&gt;@Composable&lt;/span&gt;
&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;ConfigurableButtonToo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;modifier&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Modifier&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Modifier&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Unit&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;modifier&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;modifier&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;onClick&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Click me!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice how &lt;code&gt;action&lt;/code&gt; is just passed directly to the &lt;code&gt;onClick&lt;/code&gt; parameter without any curly braces at all. This would still be perfectly valid though: &lt;code&gt;onClick = { action() }&lt;/code&gt;, it's just another waste of keystrokes.&lt;/p&gt;

&lt;p&gt;To close out this section, we can simply say that if two lambda's have the same signature you can just pass one into the other without using curly braces or parentheses at all. If they have different signatures, you'll need to expand the receiver with curly braces and populate the parameters.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advanced Usages
&lt;/h2&gt;

&lt;p&gt;One thing that really strikes you as odd the first time you see it is that you can directly reference a function, perhaps from a ViewModel, and use it as a value for the lambda. Consider the following example where the ViewModel has a function with a signature matching Button's onClick parameter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ButtonViewModel&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ViewModel&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="py"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="k"&gt;by&lt;/span&gt; &lt;span class="nf"&gt;mutableStateOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;set&lt;/span&gt;

    &lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;onSetData&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Primary button clicked!"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nd"&gt;@Composable&lt;/span&gt;
&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;ButtonView&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;viewModel&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ButtonViewModel&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;viewModel&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nc"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;onClick&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;viewModel&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;onSetData&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Primary button"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice the double colon's which say "go to this class and use this function as the lambda." Not being aware of this capability, you would be inclined to just open curly braces and call the ViewModel's function "appropriately", which is still perfectly valid and the IDE won't make a suggestion at all (currently, at least):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="nd"&gt;@Composable&lt;/span&gt;
&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;ButtonView&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;viewModel&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ButtonViewModel&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;viewModel&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nc"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;onClick&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;viewModel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;onSetData&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Primary button"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But once again, why use so many keystrokes and reach for those symbols while the colon is resting under your pinkie finger? Unless you've moved away from QWERTY (as you should) and your layout has the colon elsewhere… which I'm sure is still more convenient than curly braces and parentheses.&lt;/p&gt;

&lt;h2&gt;
  
  
  In Conclusion
&lt;/h2&gt;

&lt;p&gt;I hope you enjoyed reading and learned a thing or two. If you have questions, comments, or a request for understanding a more complex use case, please feel free to let me know!&lt;/p&gt;

</description>
      <category>kotlin</category>
      <category>java</category>
      <category>android</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
