Here you can find the source of minIndex(int a, int b)
Use to find the first of two characters in a string:
minIndex(s.indexOf('/'), indexOf('\'))
Parameter | Description |
---|---|
a | a parameter |
b | a parameter |
public static int minIndex(int a, int b)
//package com.java2s; /******************************************************************************* * Copyright (c) 2006 Sybase, Inc. and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*from www . j a v a2 s . c o m*/ * Sybase, Inc. - initial API and implementation *******************************************************************************/ public class Main { /** * Returns the minimum index >= 0, if any * * <p> * Use to find the first of two characters in a string:<br> * <code>minIndex(s.indexOf('/'), indexOf('\'))</code> * </p> * @param a * @param b * @return the minimum index >= 0, if any * */ public static int minIndex(int a, int b) { return (a < 0) ? b : (b < 0) ? a : (a < b) ? a : b; } }