Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 545baafb7974800002353443

Replace Parameter with Explicit Methods

Implementing the methods of a Java Interface

Start file
import ch.xyz.Logger;

public class LoggerImpl implements Logger {

	private void log(LogLevel lvl, String str) {
		/* Code */
	}

	@Override
	public void emerge(String str) {
		throw new UnsupportedOperationException("Not supported yet.");
	}

	@Override
	public void alert(String str) {
		throw new UnsupportedOperationException("Not supported yet.");
	}

	@Override
	public void critical(String str) {
		throw new UnsupportedOperationException("Not supported yet.");
	}

	@Override
	public void warning(String str) {
		throw new UnsupportedOperationException("Not supported yet.");
	}

	@Override
	public void notice(String str) {
		throw new UnsupportedOperationException("Not supported yet.");
	}

	@Override
	public void info(String str) {
		throw new UnsupportedOperationException("Not supported yet.");
	}

	@Override
	public void debug(String str) {
		throw new UnsupportedOperationException("Not supported yet.");
	}

}
End file
import ch.xyz.Logger;

public class LoggerImpl implements Logger {

	private void log(LogLevel lvl, String str) {
		/* Code */
	}

	@Override
	public void emerge(String str) {
		log(LogLevel.EMERGE, str);
	}

	@Override
	public void alert(String str) {
		log(LogLevel.ALERT, str);
	}

	@Override
	public void critical(String str) {
		log(LogLevel.CRITICAL, str);
	}

	@Override
	public void warning(String str) {
		log(LogLevel.WARNING, str);
	}

	@Override
	public void notice(String str) {
		log(LogLevel.NOTICE, str);
	}

	@Override
	public void info(String str) {
		log(LogLevel.INFO, str);
	}

	@Override
	public void debug(String str) {
		log(LogLevel.DEBUG, str);
	}

}

View Diff

11c11
< 		throw new UnsupportedOperationException("Not supported yet.");
---
> 		log(LogLevel.EMERGE, str);
16c16
< 		throw new UnsupportedOperationException("Not supported yet.");
---
> 		log(LogLevel.ALERT, str);
21c21
< 		throw new UnsupportedOperationException("Not supported yet.");
---
> 		log(LogLevel.CRITICAL, str);
26c26
< 		throw new UnsupportedOperationException("Not supported yet.");
---
> 		log(LogLevel.WARNING, str);
31c31
< 		throw new UnsupportedOperationException("Not supported yet.");
---
> 		log(LogLevel.NOTICE, str);
36c36
< 		throw new UnsupportedOperationException("Not supported yet.");
---
> 		log(LogLevel.INFO, str);
41c41
< 		throw new UnsupportedOperationException("Not supported yet.");
---
> 		log(LogLevel.DEBUG, str);

Solutions by @jkrause314:

Unlock 1 remaining solutions by signing in and submitting your own entry
Created by: @etifiux

27 active golfers, 76 entries

Solutions by @jkrause314:
34
#5 - Jon Krause / @jkrause314

03/09/2016 at 02:42AM