Q: Is there a nicer way to write "a == b ? c : a"? This is something I use every now and then, where I want to evaluate as something different for some specific case, but otherwise evaluate as the original value. Sometimes the variable name of "a" can be something long, so it feels redundant to write it twice, so I wonder if there's a nicer way to write it. One example would be something like longVariableName > 100 ? "big" : longVariableName.
This also comes up when "a" is a function call, and you don't want to call the function twice, but don't want to save the return value to a variable either. Is that possible?

A: 
This also comes up when "a" is a function call, and you don't want to call the function twice, but don't want to save the return value to a variable either. Is that possible?

You are starting to think about functional programming. These kinds of problems are solved by lifting to another context.
Memoization is one technique, or using functions to cache the outcome of a() in a closure. As long as a() is a pure function and always returns the same value (so not calling the system time...), you can write your own helper functions to do it.
Here is a minimal example of your problem:
const a = () => 5
const d = 5
const default = 6
const c = a() == d ? a() : default

So you want to avoid calling a() twice. You could do this:
const a = () => 5

const equalsOrDefault = val => compared => default => val == compared ? val : default

const c = equalsOrDefault(a())(d)(6)

That function takes the value, what to compare it with, and a default. It evaluates it exactly once, and you have a ternary with the desired effect.

A: Well, you could specify a lambda, but it depends on how many times you want to use it as to whether it is worthwhile.  The point is, the prod method is only called once per use.
    @FunctionalInterface
    interface TrinaryOperator<T> {
        T apply(T a, T b, T c);
    }
    public static void main(String[] args) {
        TrinaryOperator<Integer> decide = (a,b,c)-> a.equals(b) ? c : a;

        int v = decide.apply(prod(20,30), 600, 10);
        System.out.println(v);
        v = decide.apply(prod(20,30), 700, 10);
        System.out.println(v);
    }


     static int prod(int n, int s) {
         return n * s;
    }

