Skip to content

Instantly share code, notes, and snippets.

NSCountedSet *nsCountedSet = [[NSCountedSet alloc] initWithArray:@[@"abc",@"abc",@"abc",@"abc",@"other"]];
NSUInteger maxDublication = 0;
NSUInteger actualCount = 0;
for(NSString *s in [nsCountedSet objectEnumerator]) {
actualCount = [nsCountedSet countForObject:s]; // unnecessary checking, I want just array/enumarator of amounts.
if(maxDublication < actualCount) {
maxDublication = actualCount;
}
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4514" systemVersion="13A603" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="pCX-2V-Cdw">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3747"/>
</dependencies>
<scenes>
<!--Card Game View Controller-->
<scene sceneID="RGL-OG-MdP">
<objects>
<viewController id="pCX-2V-Cdw" customClass="CardGameViewController" sceneMemberID="viewController">
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
Log.v(MainActivity.TAG, "getView executed");
LayoutInflater layoutInflater = (LayoutInflater)MainActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View taskRoot = layoutInflater.inflate(R.layout.one_task, null);
((TextView) taskRoot.findViewById(R.id.seconds_edit_text)).setText("00");
((TextView) taskRoot.findViewById(R.id.minutes_edit_text)).setText("00");
((TextView) taskRoot.findViewById(R.id.hours_edit_text)).setText("00");
return taskRoot;
private int myMethod () {
try {
someCodeThatCouldThrowException ();
} catch (someCodeThatCouldThrowException's_Exception e) { // pseudocode
throw new myCustomDesignedExceptionForMyMethod();
}
}
private int myMethod () {
try {
someCodeThatCouldThrowException ();
} catch (someCodeThatCouldThrowException's_Exception e) { // pseudocode
throw new myCustomDesignedExceptionForMyMethod();
}
}
private int myMethod () {
try {
someCodeThatCouldThrowException ();
} catch (someCodeThatCouldThrowException's_Exception e) { // pseudocode
throw new myCustomDesigned
}
}
private int getIntFromEditText (EditText et) throws NumberFormatException {
return Integer.parseInt(et.getText().toString());
}
private int getIntFromEditText (EditText et) throws Exception {
try {
return Integer.parseInt(et.getText().toString());
} catch (NumberFormatException e) {
throw e; // because NumberFormatException describe my problem exactly
} catch (Exception e) {
throw e; // every other exception
}
}
private int getIntFromEditText (EditText et) throws Exception {
try {
return Integer.parseInt(et.getText().toString());
} catch (Exception e) {
throw new Exception();
}
}
public class IdentifyMyParts {
public static int x = 7;
public int y = 3;
}